O'Reilly logo

Mazes for Programmers by Jamis Buck

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Braiding Mazes

images/braid-maze-generated.png

A maze with no dead ends is called a braid maze.

There’s no reason this has to be all-or-nothing, though. Mazes may be heavily braided (with all or most dead ends removed), or lightly braided (with only a few dead ends removed), or anything in-between. The process we’ll consider here, called dead-end culling, will let us produce a maze with any level of braiding we desire.

Recall back in Counting Dead Ends, we added a method to Grid called, appropriately, deadends. We made it return a list of all the dead-end cells in the grid, and used it to compare maze algorithms based on how many dead ends they generated.

It turns out that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required