Recursive Backtracker
Also known as: Depth-First Search (DFS)
The classic maze generation algorithm that creates long, winding corridors with relatively few dead ends.
How It Works
- 1 Start at a random cell and mark it as visited
- 2 While there are unvisited cells, pick a random unvisited neighbor
- 3 Remove the wall between the current cell and chosen neighbor
- 4 Move to the neighbor and repeat
- 5 If no unvisited neighbors exist, backtrack to find one
Characteristics
- Creates mazes with long, twisting passages
- Relatively few dead ends compared to other algorithms
- Good for beginners due to predictable paths
- Memory efficient with iterative implementation
Best for: Traditional mazes with single solution paths