Grid pathfinding
Draw a map and compare shortest routes with BFS, Dijkstra and A*.
About this tool
Choose an example or edit the 14×14 map. Select Draw wall, Erase wall, Set start or Set goal, then activate a cell. Find path runs the selected algorithm. Clear walls retains start and goal. Editing the map or changing the algorithm clears the old result. With a mouse or pen, drag to draw or erase several cells. Touch gestures scroll the map; tap to edit.
Arrow keys move focus without changing the map or losing the highlighted path. Enter or Space applies the selected editing action. On narrow screens scroll inside the map to reach every cell; focused cells scroll into view.
Movement is horizontal or vertical, with cost 1 per step. There are no diagonals or variable terrain costs. BFS and Dijkstra therefore find equally short routes; A* uses Manhattan distance to guide its search. Equally short paths can differ. Cells explored counts removed queue entries (unique cells here), including start and goal, until the goal is reached. It is not a runtime measurement. Start equal to goal requires 0 steps and explores 1 cell.
The examples have 22 steps on the open grid, 24 around the barrier, or no route to the enclosed goal. The map, endpoints, algorithm and editing mode are saved locally. Reload restores the map without running a search; use Find path to calculate again.