PATHFINDING SIMULATION

Same maze, same goal: BFS spreads evenly in every direction like ripples before it touches the target, while A* leans hard to one side, examining far fewer cells for a path just as short. The whole difference sits inside f = g + h, where h estimates the remaining distance by the Manhattan metric. DFS charges down one branch before it deigns to backtrack, so its visited trail snakes about and the route it hands back is often absurdly long. Once the grid is dotted with mud cells that cost five times as much, Dijkstra orders its queue by total cost and prefers a cheap detour to an expensive straight line.

▸ Building the maze grid & deterministic walls…
▸ Placing the start cell (S) & goal cell (🏁)
▸ Loading BFS · DFS · Dijkstra · A*
▸ Hashing the spread steps for replay
▸ Calibrating the Manhattan heuristic & terrain cost…
▸ Ready — Online. ✅
0%
⌂ Mind & Machine

Simulation room Pathfinding

BFS · DFS · Dijkstra · A*
Online
step by step · wave spread · shortest path
Progress & efficiency
🌊 BFS — even spread
Algorithm—
Cells visited—
Frontier size—
Path length—
Path cost—
Found?—
Complexity—
Notes
Pathfinding = going from the start cell to the goal cell on the grid, avoiding walls. The algorithms differ in how they pick the next cell (queue / stack / priority queue) → they differ in how many cells must be visited and whether the path is shortest.
—
Pick a "Scenario" to change the algorithm (BFS · DFS · Dijkstra · A* · maze · compare) · 🔀 new maze · CLICK/drag on the grid to add–remove walls · click a concept for details
Your browser has canvas disabled.
Cells visited & frontier size over time cells visitedfrontier
About Pathfinding

Same maze, same goal: BFS spreads evenly in every direction like ripples before it touches the target, while A* leans hard to one side, examining far fewer cells for a path just as short. The whole difference sits inside f = g + h, where h estimates the remaining distance by the Manhattan metric. DFS charges down one branch before it deigns to backtrack, so its visited trail snakes about and the route it hands back is often absurdly long. Once the grid is dotted with mud cells that cost five times as much, Dijkstra orders its queue by total cost and prefers a cheap detour to an expensive straight line.

Related topics in Mind & Machine