Depth-First Search vs Wall Follower
Same maze, same speed, first to the exit wins. On this maze Wall Follower gets there first and turns gold.
The numbers
- DFS explored
- 676 cells
- DFS path
- 401 steps
- Wall Follower explored
- 553 cells
- Wall Follower path
- 409 steps
Depth-First Search
Depth-First Search follows one corridor as far as it goes, and only backs up when it hits a dead end. More on Depth-First Search.
Wall Follower
The Wall Follower keeps one hand on the wall and walks, which always gets you out of a maze whose start and exit are on the outside wall. More on Wall Follower.
FAQ
Which is faster in a maze, Depth-First Search or Wall Follower?
On this maze Wall Follower reached the exit first, after exploring 553 cells to 676. On other mazes the result can flip; press New race to try another.
How is the race fair?
Both solvers run on the same maze and explore the same number of cells per frame. Whoever explores fewer cells before reaching the exit finishes first and turns gold.
Which one finds the shorter path?
Depth-First Search: 401 steps to 409. Exploring fewer cells and finding the shorter path are different things.