Chapter 10Improving Your Weaving

You might have noticed something odd about the program you wrote in the last chapter, the one that generates weave mazes. Specifically, and especially if you were experimenting with smaller mazes, you probably saw that sometimes your program that was supposed to generate weave mazes, didn’t. You set it up, you ran the program, and all that came out was a boring, old, normal maze.

The problem is that the technique described in the previous chapter is actually not very reliable. Don’t get me wrong—the technique is easy to understand, straightforward to implement, and remarkably intuitive, so it has a lot going for it! But because of how it depends on random chance to determine when to tunnel under a passage, it ...

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.