Afterglowscreensavers

A* Pathfinding Race Screensaver

The A* Pathfinding Race screensaver runs three real pathfinding algorithms — A*, Dijkstra and breadth-first search — side by side on the same grid maze. It is free, runs in your browser, and ESC exits.

Live preview

A* Pathfinding Race screensaver — A*, Dijkstra and BFS racing to solve the same live maze.

Press ESC to leave fullscreen. Settings are saved in your browser only.

How the A* Pathfinding Race screensaver works

The saver builds a real random weighted grid maze, then runs A*, Dijkstra and breadth-first search on it simultaneously, each from the same start to the same goal.

Every frame each algorithm expands its real frontier by one step, shown as a spreading wave of visited cells, so you watch their true search patterns diverge live.

A* uses a real heuristic to bias its search toward the goal, so it typically explores far fewer cells than Dijkstra or plain BFS before finishing.

Once an algorithm reaches the goal, its real shortest path is traced and held while the others catch up, then a fresh random maze begins.

Three ways to find the shortest path

Pathfinding asks how to get from one node of a graph to another at the lowest cost, and the three algorithms in this race are the classic answers. Breadth-first search explores outward in rings and finds the route with the fewest steps; it is a special case of Dijkstra's algorithm on unweighted graphs, so it is optimal only when every move costs the same. Edsger Dijkstra conceived his algorithm in 1956 and published it in 1959. It handles different costs by always extending the cheapest known path first.

A* was first published in 1968 by Peter Hart, Nils Nilsson and Bertram Raphael of Stanford Research Institute, and it was created for Shakey, a mobile robot that had to plan its own actions. It is Dijkstra's method with a guide: each candidate is ranked by the cost so far plus a heuristic estimate of the cost remaining. When that estimate never overestimates the true cost, a property called admissibility, A* is guaranteed to return an optimal solution.

That is the contrast you see in the race. Dijkstra's algorithm is A* with a heuristic of zero for every node, so it fans out in all directions, while A* leans towards the goal. A weak or misleading heuristic erodes the advantage, which is why choosing a good estimate is the main craft in practical uses such as game movement and route planning.

A worked example

A* often carves a narrow, goal-directed beam of visited cells straight toward the target, while Dijkstra and BFS spread out in a much wider, slower-growing circle around the start.

Settings & tips

Frequently asked questions

Are these real pathfinding algorithms?
Yes — real A*, Dijkstra and breadth-first search implementations, run live on the same maze.
Why does A* usually win?
Its real heuristic biases the search toward the goal, so it explores far fewer cells than the others.
Is a key needed?
No — it is a pure local computation.
Is it free?
Yes — free, no download, in your browser.
What is a heuristic in A*?
It is an estimate of the remaining cost to the goal, such as straight-line distance on a map. A good one steers the search toward the target; a misleading one wastes effort.
Is A* always faster than Dijkstra?
Not always. With a heuristic of zero A* is exactly Dijkstra's algorithm, and a poor heuristic gives little or no saving, but with a good admissible one it usually explores fewer cells.
Why can breadth-first search give a worse route here?
On a grid where cells have different costs, breadth-first search minimises the number of steps, not the total cost, so it may take a route that is short but expensive.

← All Science & Research screensavers