This is an algorithm that is able to solve any size "8-square puzzle". (See table below)
This is an example of a goal state:
BLANK | 1 | 2 |
3 | 4 | 5 |
6 | 7 | 8 |
This is an incorrect state, but it is solvable:
1 | 2 | BLANK |
3 | 4 | 5 |
6 | 7 | 8 |
This A* algorithm looks at the missplaced tiles (1, 2 and blank) in the incorrect state to calculate the fastest way to get to the goal state. This is a simple example, and it would return the values "left, left" to get back to the initial goal state.