↑↓ move · ↵ open · esc close

Pathfinding

Five grid search algorithms side by side on walls you draw. The search is drawn as it runs, and you can compare how many cells each one had to look at.

StatusIn progress
Built withTypeScriptA*Visualisation
Live demo

Loading the demo…

Algorithms
  • 01A*, Dijkstra, BFS, DFS and greedy searchFive ways to pick the next cell from the frontier. Draw walls, run one, or compare all five by how many cells each expanded.
Algorithm pages

Each of these has a page of its own, with the steps, the cost and the other places it is used.

How it works
  • 01Each algorithm keeps a frontier of cells to try next and picks the next one differently: BFS the oldest, DFS the newest, Dijkstra the cheapest so far, greedy the closest to the goal, and A* the cheapest so far plus an estimate of what remains.
  • 02A* is optimal when the estimate never overshoots. Raise the heuristic weight above 1 and it gets faster but may return a longer path. "Compare all" runs the five searches on your walls and prints how many cells each expanded.
More in this category
Algorithms and games

Tic-tac-toe

A tic-tac-toe opponent that cannot be beaten, built on minimax with […]

TypeScriptMinimax+1
Algorithms and games

HEX

The connection game with no draws, against an AI whose search […]

TypeScriptCanvas+1
Algorithms and games

Othello

Outflank and flip your opponent’s discs, against an AI you can switch […]

TypeScriptCanvas+3