Sliding Puzzle Solver

Press Shuffle to mix up the puzzle and use the arrow keys to move.
Press Solve if you want the algorithm to solve the puzzle for you.
Or press the 3x3 button to change the puzzle size.

Animation speed: 100%

Solve
Shuffle
Reset

Show MoreLess

The Algorithm

1. Solve the top row.

2. Solve the most left column.

3. If the remaining tiles have a dimension of 3x3 or larger go to step 1 with the smaller grid.

4. Shuffle the last 4 corner tiles until a solution is found.

5. The puzzle is solved!

Moving The Tiles

Check

We move the tile by first calculating the shortest path to its destination.

Check

Then we move the empty space one position ahead of the tile and switch them.

Show

If a tile is on its path or on a correct position we make sure A* can't consider it a valid position.