My latest project: Mazes

Update: My mazes extension is now available! See Mazes extension for more information.

For those of you who’d like a sneak peek at my latest project, feel free to grab this image:

arcade-Mazes-Playground

This will not work with the current version of MakeCode Arcade (0.8.11), so you will need to import the code into beta (https://arcade.makecode.com/beta).

When you first start the game, the duck is stuck in a cell. Press A, and the grid switches to a maze with breadcrumbs. You can follow the breadcrumbs to the end of the maze (always in the bottom-right). Press A to generate another maze and have the duck returned to the start cell (always in the top-left).

I’ll be making this into an extension eventually, including a version that works in Blocks. I’ll release it (and post about it in a separate thread) sometime after the production version of MakeCode Arcade gets bumped to a newer release.

I’ve been having a ton of fun working with mazes and learning about different algorithms. If you or your advanced students are interested in this, too, then pick up a copy of this book:

https://pragprog.com/book/jbmaze/mazes-for-programmers

I’m through Chapter 5 at the moment, and it’s been a great read so far!

3 Likes

This has been way too much fun.

The extension is basically finished, complete with a Blocks implementation. The game below was built entirely in Blocks. I’ll work on some documentation next.

Feel free to load the following image into beta to see my progress. Press A to free the duck from its cell, which starts the clock. You have 60 seconds to get to the duck to its home in the swamp. If you’re running low on time, you can cheat by hitting A again. :slight_smile:

arcade-Maze-Extension-Playground

The included custom.ts uses an alternate form of the extension which uses a static image as a common canvas. Even so, I get a 021 error on my BrainPad Arcade when the map loads. I’ll keep poking around to see if I can make it more memory-efficient, but it may be that I’m trying to load too many sprites.

Enjoy!

2 Likes

I love the mazes here!

I was the head TA in charge of the updating and helping students with homework assignments for the Data Structures and Algorithms class my last quarter at UW, and the last assignment used the data structures built up over the quarter to generate random mazes (and solve them, of course). If you’re interested, you can skim over the assignment here (though it would be a bit annoying to actually implement, as it’s built on top of all the other assignments and is, well, Java).

It did look pretty though, and runs pretty reasonably (assuming the structures were implemented efficiently!): here’s a 40x40 grid and some Voronoi mazes

And a bonus 120x120 grid that runs okay

3 Likes

I love that you use Prim and Kruskal in the assignment. Those algorithms appear later in Buck’s book that I mentioned in the other thread. For these small mazes, we don’t really need anything that complicated to carve interesting paths, but I’m sure I’ll end up implementing at least Prim in the extension eventually.

There is such interesting mathematics and “computer science-y stuff” that can be found in mazes. What I’m really enjoying about Buck’s book is that he makes it approachable. If you want to dig deeper into the mathematics and the algorithms, he points you to additional references, but he doesn’t put it in the forefront. It’d be a great book for high school students to get a taste of algorithmic thinking, and as a jumping-off point to do their own research. It’s just enough to whet the appetite of curious students.

Gorgeous visualizations, Joey. I love the Voronoi mazes in particular. I haven’t seen those before. I need to look into those more! :slight_smile:

Thanks for sharing!

1 Like

LOL … I just now realized that you link to Jamis Buck’s blog in the assignment! Love it!

Oh, to clarify, I worked on the assignment but most of it was created by the lecturer I had taught for in a previous quarter - I mainly cleaned up bugs / rewrote instructions / responded to all the students questions, and wrote the test scripts for grading it, but the visualizations and base assignment were his creation :slight_smile:

1 Like