Heuristic

This page illustrates the concept of a heuristic as used in the A* search algorithm using the tile puzzle as an example. The tile puzzle is to have 123 in the top row, 456 in second, 78 in the third. A heursitic is an estimate of how good a possible move is which can influence a decision as to what to do next.

The page shows the current state, the previous state (if available) and the possible next move(s) for the puzzle. Associated with these moves is the Manhattan Distance (the total number of rows and columns each tile is away from the desired position). Choose the lowest as your next move - though sometimes more than one move has the lowest value.

You can also select other size versions.