Åsberg

Maze Generation in Rust

For my first project in the programming language Rust, I created a terminal application that generates and animates mazes.

For some time now, a friend has been telling me about “new” and “magical” language called Rust. And after having the book Programming Rust laying around (on my hard drive) for half a year I decide it was time.

Before I started, I came up with a little experiment. I would read the book, cover to cover, without touching any code and only when I was done would I start programming. So for about a week I read the book, while regretting my experiment. And the finally I got to code.

My experience programming in Rust wasn’t nearly as bad as I had thought after reading to book. In the book I read about all kinds of advanced stuff I didn’t end up taking advantage of in this project, like explicit life times, macros, and safe multi threading.

The most fun part of this project wasn’t the new language, even though that was a lot of fun, but the cool animations I could created for the generation of mazes. To make them I used something I’ve been eying for the past few weeks now; the Box-drawing characters table of Unicode. And instead of printing the whole maze for each update, I move the cursor to the specific characters that updated. That way the updates can be made really smooth and quickly.

Source

If you want to see the source code, head to my GitHub page. Although, this being my first project in Rust and all, you probably shouldn’t look to closely.