Every "New maze" click carves a fresh perfect maze (exactly one path between any two cells, no loops) with a recursive backtracker: an iterative depth-first walk that, from the current cell, knocks down the wall to a random unvisited neighbor and recurses, backtracking along its own stack when a cell has no unvisited neighbors left, until every cell has been carved.
Three real solvers then race from the top-left cell to the bottom-right cell over that same maze:
- Wall follower — the right-hand rule: always turn into the open passage most clockwise from your last heading. Guaranteed to reach the exit of a perfect (simply-connected) maze, but it re-walks dead ends, so its path is almost always far longer than the shortest one.
- BFS — breadth-first search expands the frontier one ring of cells at a time; the first time it reaches the goal, that path is provably shortest (unweighted grid).
- A* — same guarantee as BFS, but it prioritises cells whose straight-line (Manhattan) distance to the goal is smallest, so it usually reaches the same optimal path length while expanding fewer cells.
Explored counts cells actually dequeued/expanded by each algorithm (for the wall follower, its set of distinct cells visited). Path is the number of steps in the final route once solved — compare it against BFS/A*'s optimal length to see how much extra ground the wall follower covers.