Labs · Randomness

Maze Generation & Solving

Maze Generation & Solving simulation

The backtracking self-avoiding walk carves a perfect maze: every cell is reachable and there is exactly one path between any two cells. Here that random depth-first walk knocks down walls as it goes.

Then a solver searches from the top-left to the bottom-right. Breadth-first search floods outward evenly and is guaranteed to find the shortest path. A* adds a heuristic (distance to the goal) to explore the most promising cells first, usually visiting far fewer.

Solve the same maze twice: once with breadth-first, once with A*. Compare "cells explored".

Controls

Evolved from Self-Avoiding Walk.