Start
Goal
Wall
Open
Closed
Current
Path
h(n)
Step: 0 / 0
Algorithm Options
1.0
Metrics
| Explored | 0 | Discovered | 0 |
| Path Length | - | Path Cost | - |
| Time | 0.00ms | ||
What is A*?
A* (A-star) is the most popular pathfinding algorithm. It combines Dijkstra's guaranteed shortest path with heuristic guidance toward the goal.
The Formula
A* evaluates nodes using: f(n) = g(n) + h(n)
- g(n) - Actual cost from start to node n
- h(n) - Estimated cost from n to goal (heuristic)
- f(n) - Total estimated cost through n
Heuristics & Movement
Grid (4-dir): Use Manhattan - it exactly matches the movement cost.
Free Space (8-dir): Use Euclidean or Chebyshev - they match diagonal movement costs.
- Manhattan - |dx| + |dy|
- Euclidean - √(dx² + dy²)
- Chebyshev - max(|dx|, |dy|)
- Dijkstra - h=0 (no heuristic)
Mismatched heuristics still find optimal paths but explore more nodes.
Open List 0
No nodes yet
Closed List 0
No nodes yet
| Heuristic | Explored | Discovered | Path Len | Path Cost | Time (ms) |
|---|
Click a row to load that algorithm's visualization.