Lab · hands-on
A* live
A lab with no code: draw walls, drag the start and the goal, switch modes — and watch how many nodes the algorithm expands and what path comes out. Everything the lesson proves with formulas, visible with your own eyes.
How to use this
Draw walls — drag the mouse/finger across the grid. Drag the green start and the red goal. Hit Run and watch the "nodes expanded" counter. Switch Dijkstra → A* — several times fewer nodes for the same optimal path. Greedy — fast, but the path bends. Weighted A* — turn the weight and watch the trade "fewer nodes ↔ longer path".
start
goal
wall
frontier (open)
expanded (closed)
path
What to notice: put a "wall with a hole in it" between the start and the goal. 1) Dijkstra floods nearly the whole field; A* leans toward the goal and expands a fraction of the nodes — for the same optimal path (that is heuristic dominance in action). 2) Greedy — few nodes, but the path isn't the shortest. 3) Weighted A*: w↑ → fewer nodes, longer path, but never longer than w times the optimum (bounded suboptimality).
🏠 What's next
Go back to the lesson, section "🎮 Play / poke at it" — where to run real navigation: a Godot NavMesh demo, an RTS with thousands of units (flow fields), and how to break pathfinding by getting stuck in a corner.
Connections
from the lesson
Pathfinding: A*/NavMesh — the theory: f=g+h, admissibility, weighted A*, heuristic dominance.
crossover
Classical vs ML — known map → A* beats RL outright: exactly what the node counter shows you.
What to notice afterwards (observation checklist)
- Compared the node counter: A* ≪ Dijkstra for the same path.
- Saw that Greedy is fast but the path isn't optimal.
- Turned w in Weighted A*: fewer nodes, longer path.
- Drew a "trap" (a U-shaped wall) and watched the algorithm route around it.