Visual Puzzles Maze
A Maze With Exactly One Route Through It
Generated with a recursive backtracker, then solved independently by a search algorithm to prove a route exists. No dead ends that loop, no unreachable corners.
Mazes are one of the few puzzle types where the generation algorithm is genuinely interesting, because it determines what the maze feels like to solve.
This one uses a recursive backtracker, which is a depth-first search with an explicit stack. It starts in one corner, walks to a random unvisited neighbour, knocks down the wall between them, and keeps going until it hits a dead end. Then it backs up to the last cell with an unvisited neighbour and carries on.
Why that matters
A maze built this way is what is called a perfect maze: every cell is reachable, and there is exactly one path between any two cells. No loops, no isolated pockets, no second route that makes the puzzle ambiguous.
Recursive backtracking has a characteristic personality. Because it wanders as far as it can before backing up, it produces long winding corridors and relatively few junctions, so it feels like a proper labyrinth rather than a lattice. Other algorithms produce noticeably different textures — some make mazes with many short branches, which are much easier to solve by eye.
The proof
Generating a maze correctly is not quite enough, so the route is then found independently with a breadth-first search over the wall data.
That search ignores everything the generator recorded and works only from the walls themselves. Before the maze can publish, the search has to find a path from start to finish, that path has to match the stored solution in length, every step in it has to be an orthogonal move through an actual opening, and the wall data has to be symmetrical — meaning an opening between two cells is recorded identically from both sides.
If any of that fails, the build stops.
The route below runs from the S in the top-left corner to the F in the bottom-right. Trace it with a finger before opening the reveal.
Medium Can you find your way from S to F?
Reveal the answer
Answer A path of 47 squares from S to F
There is exactly one route through this maze — it is a perfect maze, so there are no loops and no dead-end shortcuts. The solution runs for 47 squares from the top-left corner to the bottom-right, and it is drawn in red above.