The 15 puzzle (also called Gem Puzzle, Boss Puzzle, Game of Fifteen, Mystic Square and many others) is a
sliding puzzle
A sliding puzzle, sliding block puzzle, or sliding tile puzzle is a combination puzzle that challenges a player to slide (frequently flat) pieces along certain routes (usually on a board) to establish a certain end-configuration. The pieces to ...
having 15 square tiles numbered 1–15 in a frame that is 4 tiles high and 4 tiles wide, leaving one unoccupied tile 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.
Named for 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 that has 8 tiles in a 3×3 frame.
The ''n'' puzzle is a classical problem for modelling
algorithm
In mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific Computational problem, problems or to perform a computation. Algorithms are used as specificat ...
s involving
heuristic
A heuristic (; ), or heuristic technique, is any approach to problem solving or self-discovery that employs a practical method that is not guaranteed to be optimal, perfect, or rational, but is nevertheless sufficient for reaching an immediate, ...
s. Commonly used heuristics for this problem include counting the number of misplaced tiles and finding the sum of the
taxicab distance
A taxicab geometry or a Manhattan geometry is a geometry whose usual distance function or metric of Euclidean geometry is replaced by a new metric in which the distance between two points is the sum of the absolute differences of their Cartesian co ...
s 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
Invariant and invariance may refer to:
Computer science
* Invariant (computer science), an expression whose value doesn't change during program execution
** Loop invariant, a property of a program loop that is true before (and after) each iteratio ...
under any valid move, and then using this to partition the space of all possible labeled states into two
equivalence class
In mathematics, when the elements of some set S have a notion of equivalence (formalized as an equivalence relation), then one may naturally split the set S into equivalence classes. These equivalence classes are constructed so that elements a ...
es of reachable and unreachable states.
The invariant is the
parity of the permutation of all 16 squares plus the parity of the
taxicab distance
A taxicab geometry or a Manhattan geometry is a geometry whose usual distance function or metric of Euclidean geometry is replaced by a new metric in which the distance between two points is the sum of the absolute differences of their Cartesian co ...
(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 the converse holds on boards of size ''m''×''n'' provided ''m'' and ''n'' are both at least 2: all even permutations ''are'' solvable. This is straightforward but a little messy to prove by induction on ''m'' and ''n'' starting with ''m''=''n''=2. gave another proof, based on defining
equivalence class
In mathematics, when the elements of some set S have a notion of equivalence (formalized as an equivalence relation), then one may naturally split the set S into equivalence classes. These equivalence classes are constructed so that elements a ...
es via a
hamiltonian path
In the mathematical field of graph theory, a Hamiltonian path (or traceable path) is a path in an undirected or directed graph that visits each vertex exactly once. A Hamiltonian cycle (or Hamiltonian circuit) is a cycle that visits each vertex ...
.
studied the generalization of the 15 puzzle to arbitrary
finite graph
In discrete mathematics, and more specifically in graph theory, a graph is a structure amounting to a Set (mathematics), set of objects in which some pairs of the objects are in some sense "related". The objects correspond to mathematical abstra ...
s, the original problem being the case of a 4×4
grid graph
In graph theory, a lattice graph, mesh graph, or grid graph is a graph whose drawing, embedded in some Euclidean space , forms a regular tiling. This implies that the group of bijective transformations that send the graph to itself is a latti ...
. 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
In geometry, a polygon () is a plane figure that is described by a finite number of straight line segments connected to form a closed ''polygonal chain'' (or ''polygonal circuit''). The bounded plane region, the bounding circuit, or the two toge ...
, 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
In graph theory, a biconnected component (sometimes known as a 2-connected component) is a maximal biconnected subgraph. Any connected graph decomposes into a tree of biconnected components called the block-cut tree of the graph. The blocks a ...
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
In computational complexity theory, NP-hardness ( non-deterministic polynomial-time hardness) is the defining property of a class of problems that are informally "at least as hard as the hardest problems in NP". A simple example of an NP-hard pr ...
. It is also NP-hard to
approximate
An approximation is anything that is intentionally similar but not exactly equal to something else.
Etymology and usage
The word ''approximation'' is derived from Latin ''approximatus'', from ''proximus'' meaning ''very near'' and the prefix ' ...
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 Fifteen Puzzle can be solved in 43 "moves""](_blank)
Domain of the Cube Forum the 8 puzzle always can be solved in no more than 31 single-tile moves or 24 multi-tile moves (integer sequenc
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
God's algorithm is a notion originating in discussions of ways to solve the Rubik's Cube puzzle, but which can also be applied to other combinatorial puzzles and mathematical games. It refers to any algorithm which produces a solution having the fe ...
. 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
In mathematics, especially in category theory and homotopy theory, a groupoid (less often Brandt groupoid or virtual group) generalises the notion of group in several equivalent ways. A groupoid can be seen as a:
*''Group'' with a partial functi ...
(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 mathematics, an alternating group is the group of even permutations of a finite set. The alternating group on a set of elements is called the alternating group of degree , or the alternating group on letters and denoted by or
Basic prop ...
. In fact, any
sliding puzzle with square tiles of equal size can be represented by
.
Alternate proof
In an alternate view of the problem, we can consider the invariant to be the sum of the parity of the number of
inversions in the current order of the 15 numbered pieces and the parity of the difference in the row number of the empty square from the row number of the last row. (Let's call it row distance from the last row.) This is an invariant because each column move, when we move a piece within the same column, changes both the parity of the number of inversions (by changing the number of inversions by ±1, ±3) and the parity of the row distance from the last row (changing row distance by ±1); and each row move, when we move a piece within the same row, does not change either of the two parities. Now if we look at the solved state of the puzzle, this sum is even. Hence it is easy to prove by
induction
Induction, Inducible or Inductive may refer to:
Biology and medicine
* Labor induction (birth/pregnancy)
* Induction chemotherapy, in medicine
* Induced stem cells, stem cells derived from somatic, reproductive, pluripotent or other cell t ...
that any state of the puzzle for which the above sum is odd cannot be solvable. In particular, if the empty square is in the lower right corner (even anywhere in the last row) then 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
Canastota is a village located inside the Town of Lenox in Madison County, New York, United States. The population was 4,804 at the 2010 census.
The village of Canastota is in the southern part of the Town of Lenox. Canastota High School is loc ...
, 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
In recreational mathematics, a square array of numbers, usually positive integers, is called a magic square if the sums of the numbers in each row, each column, and both main diagonals are the same. The 'order' of the magic square is the number ...
). Copies of the improved Fifteen Puzzle made their way to
Syracuse, New York
Syracuse ( ) is a City (New York), city in and the county seat of Onondaga County, New York, Onondaga County, New York, United States. It is the fifth-most populous city in the state of New York following New York City, Buffalo, New York, Buffa ...
, by way of Noyes' son, Frank, and from there, via sundry connections, to
Watch Hill, Rhode Island
Watch Hill is an affluent coastal neighborhood and census-designated place in the town of Westerly, Rhode Island. The population was 154 at the 2010 census. It sits at the most-southwestern point in all of Rhode Island. It came to prominence in t ...
, and finally to
Hartford
Hartford is the capital city of the U.S. state of Connecticut. It was the seat of Hartford County until Connecticut disbanded county government in 1960. It is the core city in the Greater Hartford metropolitan area. Census estimates since the ...
(Connecticut), where students in the
American School for the Deaf
The American School for the Deaf (ASD), originally ''The American Asylum, At Hartford, For The Education And Instruction Of The Deaf'', is the oldest permanent school for the deaf in the United States, and the first school for children with disa ...
started manufacturing the puzzle and, by December 1879, selling them both locally and in
Boston
Boston (), officially the City of Boston, is the state capital and most populous city of the Commonwealth of Massachusetts, as well as the cultural and financial center of the New England region of the United States. It is the 24th- mo ...
, 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
Worcester ( , ) is a city and county seat of Worcester County, Massachusetts, United States. Named after Worcester, England, the city's population was 206,518 at the 2020 United States census, 2020 census, making it the second-List of cities i ...
, 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.
[''The 15 Puzzle'', by Jerry Slocum & Dic Sonneveld, 2006. ]
Sam Loyd
Sam Loyd
Samuel Loyd (January 30, 1841 – April 10, 1911), was an American chess player, chess composer, puzzle author, and recreational mathematics, recreational mathematician. Loyd was born in Philadelphia but raised in New York City.
As a chess com ...
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 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 fuelled 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
The Minus Cube (aka BLOXBOX by Piet Hein; aka Varikon Box) is a 3D mechanical variant of the ''n''-puzzle, which was manufactured in the Soviet Union. It consists of a bonded transparent plastic box containing seven small cubes, each glued t ...
, manufactured in the
USSR
The Soviet Union,. officially the Union of Soviet Socialist Republics. (USSR),. was a transcontinental country that spanned much of Eurasia from 1922 to 1991. A flagship communist state, it was nominally a federal union of fifteen nationa ...
, is a
3D puzzle with similar operations to the 15 puzzle.
Chess world champion Bobby Fischer
Robert James Fischer (March 9, 1943January 17, 2008) was an American chess grandmaster and the eleventh World Chess Champion. A chess prodigy, he won his first of a record eight US Championships at the age of 14. In 1964, he won with an 11â ...
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
''The Tonight Show Starring Johnny Carson'' was an American late-night talk show hosted by Johnny Carson on NBC, the third iteration of the ''Tonight Show'' franchise. The show debuted on October 1, 1962, and aired its final episode on May 22, ...
''.
[Adam Spencer, ''Adam Spencer's Big Book of Numbers: Everything you wanted to know about the numbers 1 to 100'', p. 58, Brio Books, 2014 .]
See also
*
Combination puzzles
A combination puzzle, also known as a sequential move puzzle, is a puzzle which consists of a set of pieces which can be manipulated into different combinations by a group of operations. Many such puzzles are mechanical puzzles of polyhedral s ...
*
Jeu de taquin In the mathematical field of combinatorics, jeu de taquin is a construction due to which defines an equivalence relation on the set of skew standard Young tableaux. A jeu de taquin slide is a transformation where the numbers in a tableau are move ...
, an operation on skew Young tableaux similar to the moves of the 15 puzzle
*
Klotski
Klotski (from pl, klocki, lit=wooden blocks) is a sliding block puzzle thought to have originated in the early 20th century. The name may refer to a specific layout of ten blocks, or in a more global sense to refer to a whole group of similar s ...
*
Mechanical puzzles
A mechanical puzzle is a puzzle presented as a set of mechanically interlinked pieces in which the solution is to manipulate the whole object or parts of it. While puzzles of this type have been in use by humanity as early as the 3rd century BC ...
*
Pebble motion problems
*
Rubik's Cube
The Rubik's Cube is a Three-dimensional space, 3-D combination puzzle originally invented in 1974 by Hungarians, Hungarian sculptor and professor of architecture Ernő Rubik. Originally called the Magic Cube, the puzzle was licensed by Rubik t ...
*
Three cups problem
The three cups problem, also known as the three cup challenge and other variants, is a mathematical puzzle that, in its most common form, cannot be solved.
In the beginning position of the problem, one cup is upside-down and the other two are rig ...
Notes
References
*
*
* Edward Kasner & James Newman (1940)
Mathematics and the Imagination
''Mathematics and the Imagination'' is a book published in New York by Simon & Schuster in 1940. The authors are Edward Kasner and James R. Newman. The illustrator Rufus Isaacs provided 169 figures. It rapidly became a best-seller and received s ...
, pp 177–80,
Simon & Schuster
Simon & Schuster () is an American publishing company and a subsidiary of Paramount Global. It was founded in New York City on January 2, 1924 by Richard L. Simon and M. Lincoln Schuster. As of 2016, Simon & Schuster was the third largest publ ...
.
*
*
External links
{{Commons category
The history of the 15 puzzleMaximal number of moves required for the m X n generalization of the 15 puzzlewith download (from Herbert Kociemba)
Mechanical puzzles
Combination puzzles
NP-complete problems
Permutations
19th-century fads and trends