Chapter 6Fitting Mazes to Shapes

images/recursive-backtracker-output-01.png

Let’s take a little break from new maze algorithms and try to get a feel for what we’ve currently got in our toolboxes. At this point, we’re pretty comfortable making rectangular mazes.

images/maze-text.png

In this chapter, we’re going to take it to the next level and learn how to make mazes that fit into arbitrary shapes.

The secret is a remarkably simple little technique called masking, which constrains a maze to fit within an arbitrary shape. It’s got its own set of warts, but on the whole it’s a really useful tool.

We’ll begin ...

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.