How does the sliding puzzle work?
Numbered tiles sit in a square frame with one empty space. Tap a tile in the same row or column as the gap and it slides in, pushing any tiles between them along. Arrow keys slide the tile next to the gap. Put the tiles back in order, 1, 2, 3 and on, with the gap in the bottom-right corner. You can play the 3×3 board, often called the 8 puzzle, the 4×4 board, the classic 15 puzzle, or the 5×5 board, the 24 puzzle.
How is your result calculated?
Your result is the number of moves, counting every tile that moves, so sliding three tiles at once is three moves. The clock starts on your first move. On 3×3, when the tiles are dealt, the site works out the fewest moves that deal could be solved in, and your moves are compared with that number. On 4×4 and 5×5 there are far too many possible positions to do that quickly in a browser, so only your own count is shown.
Why can't every sliding puzzle be solved?
Exactly half of all the ways to arrange the tiles can never be put back in order, however long you slide. Each slide preserves a hidden kind of parity, counted from how many pairs of tiles are in the wrong order, so a board on the wrong side of it can never reach the solved one. William Woolsey Johnson and William Edward Story proved this in 1879, as the 15 puzzle craze was beginning. The best-known impossible position is the solved board with 14 and 15 swapped.
Every deal here is checked to be solvable before you see it. On 3×3 there are 181,440 solvable arrangements, exactly half of the 362,880 ways to place the tiles, and the hardest of them needs 31 moves. The site's tests confirm both numbers by exploring every one of them.
What is the trick to sliding puzzles?
- Solve one row at a time. Put the top row in place and then leave it alone. On 4×4, do the second row the same way; on 5×5, the second and third.
- Finish the last two rows column by column. Bring the two tiles of each column into place together, by cycling them around the gap.
- Place the last tile of a row with a detour. Park it just below its spot, then slide the tile beside it out and back so both drop into line.
For another puzzle about sliding pieces in a tight space, try the Traffic Jam Puzzle; for a puzzle with a proven fewest moves, the Tower of Hanoi.