An estimate in every cell 16 15 14 13 12 11 10 9 8 7 6 16 14 13 10 9 5 15 13 12 11 10 9 8 7 6 4 14 8 5 3 13 12 11 10 9 8 7 5 4 2 12 10 9 7 6 4 1 11 9 8 7 6 5 4 3 2 1 S The numbers are h: the Manhattan distance from the cell to the goal, ignoring walls and mud, the sum of horizontal and vertical steps. The real cost cannot be smaller.
Running towards the goal: 3 cells opened 16 15 14 13 12 11 10 9 8 7 6 16 14 13 10 9 5 15 13 12 11 10 9 8 7 6 4 14 8 5 3 13 12 11 10 9 8 7 5 4 2 12 10 9 7 6 4 1 11 9 8 7 6 5 4 3 2 1 S Greedy search only looks at h and opens the cell that looks closest to the goal. It moves fast and opens few cells. 3 cells are on the frontier.
Running towards the goal: 6 cells opened 16 15 14 13 12 11 10 9 8 7 6 16 14 13 10 9 5 15 13 12 11 10 9 8 7 6 4 14 8 5 3 13 12 11 10 9 8 7 5 4 2 12 10 9 7 6 4 1 11 9 8 7 6 5 4 3 2 1 S Greedy search only looks at h and opens the cell that looks closest to the goal. It moves fast and opens few cells. 4 cells are on the frontier.
Running towards the goal: 9 cells opened 16 15 14 13 12 11 10 9 8 7 6 16 14 13 10 9 5 15 13 12 11 10 9 8 7 6 4 14 8 5 3 13 12 11 10 9 8 7 5 4 2 12 10 9 7 6 4 1 11 9 8 7 6 5 4 3 2 1 S Greedy search only looks at h and opens the cell that looks closest to the goal. It moves fast and opens few cells. 6 cells are on the frontier.
Running towards the goal: 12 cells opened 16 15 14 13 12 11 10 9 8 7 6 16 14 13 10 9 5 15 13 12 11 10 9 8 7 6 4 14 8 5 3 13 12 11 10 9 8 7 5 4 2 12 10 9 7 6 4 1 11 9 8 7 6 5 4 3 2 1 S Greedy search only looks at h and opens the cell that looks closest to the goal. It moves fast and opens few cells. 6 cells are on the frontier.
Running towards the goal: 15 cells opened 16 15 14 13 12 11 10 9 8 7 6 16 14 13 10 9 5 15 13 12 11 10 9 8 7 6 4 14 8 5 3 13 12 11 10 9 8 7 5 4 2 12 10 9 7 6 4 1 11 9 8 7 6 5 4 3 2 1 S Greedy search only looks at h and opens the cell that looks closest to the goal. It moves fast and opens few cells. 6 cells are on the frontier.
Running towards the goal: 18 cells opened 16 15 14 13 12 11 10 9 8 7 6 16 14 13 10 9 5 15 13 12 11 10 9 8 7 6 4 14 8 5 3 13 12 11 10 9 8 7 5 4 2 12 10 9 7 6 4 1 11 9 8 7 6 5 4 3 2 1 S Greedy search only looks at h and opens the cell that looks closest to the goal. It moves fast and opens few cells. 5 cells are on the frontier.
Fast but possibly expensive 16 15 14 13 12 11 10 9 8 7 6 16 14 13 10 9 5 15 13 12 11 10 9 8 7 6 4 14 8 5 3 13 12 11 10 9 8 7 5 4 2 12 10 9 7 6 4 1 11 9 8 7 6 5 4 3 2 1 S The path is 17 steps and costs 25. Greedy search never counts the cost of getting here, so the path it finds may be neither the shortest nor the cheapest. It opened 18 cells.
Why it matters 16 15 14 13 12 11 10 9 8 7 6 16 14 13 10 9 5 15 13 12 11 10 9 8 7 6 4 14 8 5 3 13 12 11 10 9 8 7 5 4 2 12 10 9 7 6 4 1 11 9 8 7 6 5 4 3 2 1 S A good heuristic keeps the search from spreading in every direction. A* combines this estimate with the g of uniform cost and becomes both fast and cheapest.