solution to sliding tile problem

I solved this problem by using a computer program. It is evident that from any given position there may be several possible next positions. From the starting position, make a list of the start position and all possible next positions. Call the start position level 0. and the possible next positions level 1 positions. From each level 1 position add to the list all possible next positions. Call these level 2 positions. Number the entries in the list and include with the position the number of its predecessor and the step number. Continue in this fashion for many levels, checking each position to see if it is the required end position. Obviously, the list gets very large quite quickly. Before adding a position to the list, make sure it is not already in the list, otherwise you may form an endless loop. When eventually the required position is reached, the solution may be found by tracing back to the starting position, using the numbers of the preceding positions. This gives the solution in reverse order which must then be reversed. This procedure is called a "Breadth First Tree search" It finds all possible positions reachable from the starting position in a given number of moves. Hence, the solution it finds is bound to be the minimum.
In this case there are 86 steps in the minimum solution. Enter the step number to select state.

Enter an integer to dispay state after step number. (Range 1-86)

<