Spiral Backtracker maze algorithm
The Spiral Backtracker is a recursive backtracker that prefers to keep turning the same way, so its corridors coil into spirals.
How it works
It works like the recursive backtracker (walk to an unvisited neighbour, back up when stuck), but instead of choosing a neighbour at random it prefers the one that turns clockwise from the way it was heading, then straight on, with a little noise to break ties.
That bias makes the walk curl round on itself, laying down nested spirals and long concentric corridors. It still visits every cell once, so the maze is perfect.
What to watch for
Watch the head wind round in tight coils, back out, and start a new spiral somewhere else.
Properties
- Texture
- Spirals and coils
- Dead ends
- Few
- Uniform
- No (strongly biased)
- Speed
- Fast
- Memory
- A stack
Try it
Open the studio to carve your own Spiral Backtracker maze at any size, solve it with up to four algorithms, and save the video.
FAQ
Is this a standard algorithm?
It's a variation on the recursive backtracker made for MazeSim: the same algorithm with a turning preference instead of a random choice.