Lab — Games & algorithms

Maze Lab

Maze Lab is a free online tool that generates a perfect maze and animates the A* search algorithm solving it — watch the frontier flood the maze, dead ends get pruned, and the shortest path snap into view, all in your browser.

Controls

Maze

Start Goal Visited Frontier Shortest path

Results

21 × 21
Maze size
0
Cells visited
—
Path length (steps)
Ready
Status
How A* works

A* scores every candidate cell as f = g + h: g is the steps already taken from the start, h is the Manhattan distance (up/down/left/right steps, ignoring walls) to the goal. At each step it expands the lowest-f cell on the frontier. Because h never overestimates the true remaining distance, the first time A* reaches the goal it has found a shortest path — everything else it visited was the price of proving it.