Text & documents
Numbers & maths
Data & formats
Security
Development & DevOps
Artificial Intelligence
Finance
Health & Wellness
Productivity
Games & Entertainment
Multimedia & design
Business
How to use
How to use it

Press Play and watch the algorithm search: light blue is what it has already looked at (expanded), yellow is what it still has pending (the frontier) and, at the end, blue is the path. Paint walls, mud or traps by dragging over the grid, and move the start and the goal.

How they differ

They all do the same thing: take a cell out of the frontier, expand it and add its neighbours. The only difference is WHICH one they take. Breadth-first, the oldest (fewest steps). Depth-first, the newest (finds something, rarely the best). Uniform cost, the cheapest so far (the cheapest path). Greedy, the one that looks closest to the goal (fast, but easily fooled). A*, the one that adds what was spent and what seems to be left: the cheapest path while looking at less.

The weight in A*

With weight 1, A* always gives the cheapest path, because the straight-line (Manhattan) distance never overestimates what is really left. Raising it makes A* trust that estimate more: it looks at fewer cells, but may stop giving the best path. With a very high weight it behaves like greedy.

Search: paths and gamesHow an AI searches: breadth-first, A* and minimax, step by step
Search: paths and gamesHow an AI searches: breadth-first, A* and minimax, step by step

Takes the one with the lowest sum of what was spent and what seems to be left (g + weight·h). With weight 1, the cheapest path while looking at fewer cells.

Paint by dragging:

Going over something already painted with the same brush erases it.

0 expanded · 1 in the frontier

Press Play to watch the search, or «To the end» for the result at once.

All five on this same grid
AlgorithmExpandedStepsCost
10318 18
2120 20
10318 18
3120 20
6218 18