15 Puzzle

15 Puzzle
The 15 Puzzle (also called Gem Puzzle, Boss Puzzle, Game of Fifteen, Mystic Square and many others) is a sliding puzzle which has 15 square tiles numbered 1 to 15 in a frame that is 4 tile positions high and 4 positions wide, with one unoccupied position. Tiles in the same row or column of the open position can be moved by sliding them horizontally or vertically, respectively. The goal of the puzzle is to place the tiles in numerical order (from left to right, top to bottom).
Named after the number of tiles in the frame, the 15 Puzzle may also be called a "16 Puzzle", alluding to its total tile capacity. Similar names are used for different sized variants of the 15 Puzzle, such as the 8 Puzzle, which has 8 tiles in a 3×3 frame.
The n Puzzle is a classical problem for modeling algorithms involving heuristics. Commonly used heuristics for this problem include counting the number of misplaced tiles and finding the sum of the taxicab distances between each block and its position in the goal configuration. Note that both are admissible. That is, they never overestimate the number of moves left, which ensures optimality for certain search algorithms such as A*.
Mathematics
Solvability
used a parity argument to show that half of the starting positions for the n Puzzle are impossible to resolve, no matter how many moves are made. This is done by considering a function of the tile configuration that is invariant under any valid move and then using this to partition the space of all possible labelled states into two equivalence classes of reachable and unreachable states.
The invariant is the parity of the permutation of all 16 squares plus the parity of the taxicab distance (number of rows plus number of columns) of the empty square from the lower right corner. This is an invariant because each move changes both the parity of the permutation and the parity of the taxicab distance. In particular, if the empty square is in the lower right corner, then the puzzle is solvable if and only if the permutation of the remaining pieces is even.
also showed that on boards of size m × n, where m and n are both larger or equal to 2, all even permutations are solvable. It can be proven by induction on m and n, starting with m = n = 2. gave another proof, based on defining equivalence classes via a Hamiltonian path.
studied the generalization of the 15 Puzzle to arbitrary finite graphs, the original problem being the case of a 4×4 grid graph. The problem has some degenerate cases where the answer is either trivial or a simple combination of the answers to the same problem on some subgraphs. Namely, for paths and polygons, the puzzle has no freedom; if the graph is disconnected, only the connected component of the vertex with the "empty space" is relevant; and if there is an articulation vertex, the problem reduces to the same puzzle on each of the biconnected components of that vertex. Excluding these cases, Wilson showed that other than one exceptional graph on 7 vertices, it is possible to obtain all permutations unless the graph is bipartite, in which case exactly the even permutations can be obtained. The exceptional graph is a regular hexagon with one diagonal and a vertex at the center added; only of its permutations can be attained.
For larger versions of the n Puzzle, finding a solution is easy. But, the problem of finding the shortest solution is NP-hard. It is also NP-hard to approximate the fewest slides within an additive constant, but there is a polynomial-time constant-factor approximation. For the 15 Puzzle, lengths of optimal solutions range from 0 to 80 single-tile moves (there are 17 configurations requiring 80 moves) or 43 multi-tile moves; the 8 Puzzle always can be solved in no more than 31 single-tile moves or 24 multi-tile moves (integer sequence A087725). The multi-tile metric counts subsequent moves of the empty tile in the same direction as one.
The number of possible positions of the 24 Puzzle is ≈ , which is too many to calculate God's number feasibly using brute-force methods. In 2011, lower bounds of 152 single-tile moves or 41 multi-tile moves had been established, as well as upper bounds of 208 single-tile moves or 109 multi-tile moves. In 2016, the upper bound was improved to 205 single-tile moves.
The transformations of the fifteen puzzle form a groupoid (not a group, as not all moves can be composed); this groupoid acts on configurations.
Group theory
Because the combinations of the 15 Puzzle can be generated by 3-cycles, it can be proved that the 15 Puzzle can be represented by the alternating group . In fact, any sliding puzzle with square tiles of equal size can be represented by .
Alternate proof
In an alternate view of the problem, the invariant can be considered as the sum of two components. The first component is the parity of the number of inversions in the current order of the 15 numbered pieces, and the second component is the parity of the difference in the row number of the empty square from the row number of the last row (referred to as row distance from the last row). This invariant remains constant throughout the puzzle-solving process.
The validity of this invariant is based on the following observations: each column move, involving the movement of a piece within the same column, changes both the parity of the number of inversions (by ±1 or ±3) and the parity of the row distance from the last row (by ±1). Conversely, each row move, which entails moving a piece within the same row, does not affect either of the two parities. Analyzing the solved state of the puzzle reveals that the sum of these parities is always even.
Through induction, it can be proven that any state of the puzzle in which the above sum is odd cannot be solved. In particular, when the empty square is located in the lower right corner or anywhere in the last row, the puzzle is solvable if and only if the number of inversions of the numbered pieces is even.
History
The puzzle was "invented" by Noyes Palmer Chapman, a postmaster in Canastota, New York, who is said to have shown friends, as early as 1874, a precursor puzzle consisting of 16 numbered blocks that were to be put together in rows of four, each summing to 34 (see magic square). Copies of the improved 15 Puzzle made their way to Syracuse, New York, by way of Noyes' son, Frank, and from there, via sundry connections, to Watch Hill, Rhode Island, and finally to Hartford (Connecticut), where students in the American School for the Deaf started manufacturing the puzzle and, by December 1879, selling them both locally and in Boston, Massachusetts. Shown one of these, Matthias Rice, who ran a fancy woodworking business in Boston, started manufacturing the puzzle sometime in December 1879 and convinced a "Yankee Notions" fancy goods dealer to sell them under the name of "Gem Puzzle". In late January 1880, Charles Pevey, a dentist in Worcester, Massachusetts, garnered some attention by offering a cash reward for a solution to the Fifteen Puzzle.
The game became a craze in the U.S. in 1880.
Noyes Chapman had applied for a patent on his "Block Solitaire Puzzle" on February 21, 1880. However, that patent was rejected, likely because it was not sufficiently different from the August 20, 1878 "Puzzle-Blocks" patent (US 207124) granted to Ernest U. Kinsey.
Sam Loyd
Sam Loyd claimed, from 1891 until his death in 1911, that he had invented the puzzle. However, Loyd had nothing to do with the invention or initial popularity of the puzzle, and in any case, the craze was in 1880, not in the early 1870s. Loyd's first article about the puzzle was published in 1886, and it was not until 1891 that he first claimed to be the inventor.
Some later interest was fueled by Loyd's offer of a $1,000 prize to anyone who could provide a solution for achieving a particular combination specified by Loyd, namely reversing the 14 and 15, which Loyd called the 14-15 puzzle. This is impossible, as had been shown over a decade earlier by , because it requires a transformation from an even to an odd permutation.
Miscellaneous
The Minus Cube, manufactured in the USSR, is a 3D puzzle with similar operations to the 15 Puzzle.
Chess world champion Bobby Fischer was an expert at solving the 15 Puzzle. He had been timed to be able to solve it within 25 seconds; Fischer demonstrated this on November 8, 1972, on The Tonight Show Starring Johnny Carson.
See also
Combination puzzles
Jeu de taquin, an operation on skew Young tableaux similar to the moves of the 15 puzzle
Klotski
Mechanical puzzles
Pebble motion problems
Rubik's Cube
Three cups problem
Notes
References
Edward Kasner & James Newman (1940) Mathematics and the Imagination, pp 177–80, Simon & Schuster.
External links
The history of the 15 puzzle
Fifteen Puzzle Solution
Maximal number of moves required for the m X n generalization of the 15 puzzle
15-Puzzle Optimal Solver with download (from Herbert Kociemba)
Mechanical puzzles
Combination puzzles
NP-complete problems
Permutations
19th-century fads and trends