Pathfinder
Draw walls on a grid and watch A* and Dijkstra race to the goal, step by step. Built for CS2040S tutorials.
- AwardOutstanding Teaching AssistantNUS School of Computing (sample) · 2026
- Commits
- 61
- Stars
- 27
- Last commit
- 4 months ago
The problem
Students in my CS2040S tutorials could recite A* but couldn't say why it beats Dijkstra on a grid. Slides showed the answer, not the search.
Who it's for
First-year data structures and algorithms students, and the TAs who teach them.
Why I built it
I TA the module. Watching the search frontier grow explains a heuristic faster than anything I could say.
What I built
A grid you draw walls on. A*, Dijkstra and BFS run side by side, step by step, with a speed slider.
How it works
Plain JavaScript and a canvas. Each algorithm is a generator that yields one step at a time, so all three animate on the same clock.
Hard parts and decisions
Keeping the three in lockstep without the fastest one finishing before the others had visibly started. Generators fixed it.
What happened
Used in four tutorial groups this semester. Two other TAs asked to use it in their sections.
What I'd do next
Weighted cells (mud, water) so students can see where Dijkstra and A* actually diverge.