# Sliding 15-Puzzle

The 15-puzzle and its smaller version, the 8-puzzle are classic sliding puzzles, consisting of numbered square tiles which can be slid in a frame using an empty slot. The object is to slide all tiles where they belong using the empty space. The solved state can be marked with numbers or an image. One possible solution of the numbered verion is shown on the image supplied.

You can try to solve this puzzle clicking the button below. The simulator allows you to set up your own image and send the link to your friends to challenge them to solve the puzzle with your image. Just set the link (url) of any image or use a Facebook profile or page id.

## How to solve the 15-Puzzle

The solution of a 15-Puzzle is not so hard, it can easily be done intuitively. You only need to know a little trick when you reach the last two pieces of a layer.

Let’s say we have a 4×4 puzzle and we want to solve it starting with the tile marked with 1 in the upper left corner. Placing the first two pieces can’t be a challenge, but you might need a little trick when you reach the **last two pieces of the layer**. Instead of positioning tile nr 3, then nr 4 we are going to solve these two together. Place 4 where 3 should be, 3 below it and move the empty slot next to 4. After that slide 4 to the right and move 3 up to the empty space as shown on the image. You can solve the second layer the same way.

When you reach the last two layers we need to use the same trick to solve the two tiles on the left corner: 9 and 13. After that comes the positioning of tiles nr 10 and 14 and you just have to rotate the remaining 3 tiles at the end to finish the puzzle.

This solution method takes about 70 steps to solve a 4×4 puzzle from any random starting position. The same idea can be applied for the 8-puzzle too.