2 ms·
When my kids were smaller, they would often request that I make mazes for them on restaurant placemats, etc. Since I was working in crayon, many of the traditio
by andrewla 3y ago
When my kids were smaller, they would often request that I make mazes for them on restaurant placemats, etc. Since I was working in crayon, many of the traditional maze generation algorithms, which relied on removing walls, were inapplicable.
What I found, though, was that you can construct mazes additively, while ensuring a single unique solution, by looking at the dual of the maze. If you start by drawing a shape with an entrance and an exit, you can start at any wall (including the borders, and just start drawing lines out that do not intersect previous lines. Basically you get a forest-like structure.
The neat thing is that this method can generate all mazes, and you can look at any generated maze, and if you just look at the dual (the tree-like graph of the walls) it's surprisingly easy to see the solution almost immediately. Hard to unsee once you get into the mindset of looking for it.