$

./pathfinding

||slowfast|[READY]
A* Search
Expands by f = g + h. g = accumulated cost, h = Manhattan heuristic.
Time
O(b^d)
Space
O(b^d)
Optimal
Yes
Heuristic
Yes
insight
Gold standard for grid pathfinding. Finds optimal path while exploring fewer nodes than Dijkstra.
cost function
Distance only
Edge length (1 or √2)
Terrain cost
dist × terrain type multiplier
Elevation / Slope
dist × slope factor (uphill costly, downhill cheap)
Combined (realistic)
dist × terrain × slope — cliffs impassable
compare all
A*opthO(b^d)
DijkstraoptO(V+E·logV)
BFSoptO(V+E)
DFSO(V+E)
GreedyhO(b^d)
BiDiroptO(b^(d/2))
LeeoptO(V)
draw:
SEwallvisitedpathwpmud×2water×3swamp×5