8 puzzle

Description

The 8-puzzle is a square board with 9 positions, filled by 8 numbered tiles and one gap.

At any point, a tile adjacent to the gap can be moved into the gap, creating a new gap position. in other words the gap can be swapped with an adjacent tile.

The objective in the game is to begin with an arbitrary configuration of tiles, and move them so as to get the numbered tiles arranged in ascending order either running around the perimeter of the board or ordered from left to right, with 1 in the top left-hand position.

Game Rules

To move : if there is an empty adjacent square next to a tile, a tile may be slid into the empty location.

To win : The tiles must be moved back into their original positions, numbered 1 throught 8 within given time.