Your Turn

So we see that it’s true: not all biases are bad! By constraining the selection of cells during the random walk—forbidding those that have already been visited, for example—we can produce mazes with a bias toward more river. We saw how Hunt-and-Kill and Recursive Backtracker both use this technique to good effect.

Once again, it’s time to play with what you’ve acquired. What other constraints can you add to the random walks? What if you change the existing constraints somehow? The following ideas may help get you started.

Hunting Strategies

We looked at one strategy for finding cells in the hunt phase of the Hunt-and-Kill algorithm: simply looking at the cells in order until one is located. What other ways can you think of to hunt for ...

Get Mazes for Programmers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.