A fun little toy/demo displaying some maze algorithms.
Note the mazes generated are perfect mazes, meaning they have exactly one path from any point to any other point inside the maze. They're not so useful for making games without some adaptation.
Binary tree: at each cell, decides to go either down or right. Produces a bias towards diagonal movement and obvious lines at the bottom/right.
Sidewinder: goes along a run of cells horizontally, then adds one passage downwards. Tends towards vertical movement and obvious line at the bottom.
Aldous-Broder: random walk filling in cells as they're visited. Produces a totally unbiased maze (assuming rnd() is unbiased) but can be slow at the end.
If you're interested in the topic I recommend this book (that I got the idea/algorithms from): Mazes for Programmers.
[Please log in to post a comment]