Braiding Mazes
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 ...
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.