Sliding Tile Puzzle Screensaver
The Sliding Tile Puzzle screensaver shows the classic 15-puzzle solving itself over and over, shuffling and then calmly re-solving. It is free, runs in your browser, and ESC exits.
How the Sliding Tile Puzzle screensaver works
The saver starts with a solved grid, then performs a random shuffle of valid sliding moves.
A simple solving algorithm then slides tiles back into order, one legal move at a time.
Once solved, the cycle pauses briefly before shuffling again.
Every move follows the real sliding-puzzle rules — only the tile next to the empty space can move.
The maths of the 15-puzzle
The 15-puzzle, a four-by-four tray with fifteen numbered sliding tiles and one empty space, became a craze in the late nineteenth century. Noyes Palmer Chapman, a postmaster in Canastota, New York, is credited with inventing it. The puzzle maker Sam Loyd later claimed the invention himself, though he is not thought to have had any connection to it, and he is remembered for offering a $1,000 prize for swapping just the 14 and 15 tiles. That challenge was impossible.
The reason is parity. Johnson and Story used a parity argument to show that only half of the 16! possible arrangements, about ten trillion, can be reached from the solved one, and an arrangement with a single swapped pair falls in the unreachable half. In 1974 Wilson generalised the puzzle to arbitrary graphs and showed that, apart from a few degenerate cases, every permutation is reachable unless the graph is bipartite, where only even permutations are.
Solving it optimally is a classic problem in artificial intelligence. Search methods such as A* and iterative-deepening A*, guided by a heuristic like the Manhattan distance, find shortest solutions. Optimal solutions range from 0 to 80 single-tile moves, and 17 starting positions need all 80. Humans generally use a layered strategy instead, placing the top row and then the next rows.
A worked example
The grid shuffles into a scrambled state, then tile by tile it methodically slides back into perfect numerical order.
Settings & tips
- Accent recolours the tile numbers.
- Every move follows the real sliding-puzzle rules.
- A calming, satisfying loop to watch.
Frequently asked questions
- Can I play this myself?
- It runs in a self-playing loop rather than an interactive mode.
- Does it always find a solution?
- Yes — every shuffle only uses valid moves, so it is always solvable.
- Is a key needed?
- No — it is a pure visual animation.
- Is it free?
- Yes — free, no download, in your browser.
- Why was Sam Loyd's 14-15 puzzle impossible?
- Swapping only the 14 and 15 tiles produces an arrangement with the wrong parity, and legal slides can never reach it.
- How many moves does the hardest position need?
- Computer searches show optimal solutions to the 15-puzzle need at most 80 single-tile moves.
- What is the Manhattan distance heuristic?
- It adds up how many rows and columns each tile is from its target place, giving a lower bound on moves that guides the search.