Jump to content

15 puzzle: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Spinningspark (talk | contribs)
Noyes Chapman's Fifteen Puzzle: The person who copy edited this section clearly did not understand. The unsolvable puzzle is indeed due to Loyd (or at least was promulgated by him) and the text has been conflated with the 15 puzzle
Jokes Free4Me (talk | contribs)
Solvability: more info
Line 8: Line 8:


The invariant is the [[Parity of a permutation|parity of permutations]] of all 16 squares (15 pieces plus empty square) plus the parity of the [[taxicab distance]] moved by the empty square. This is an invariant because each move changes the parity of the permutation and the parity of the taxicab distance. In particular if the empty square is not moved the permutation of the remaining pieces must be even. The same argument works for all rectangular boards, or more generally for all boards with no odd cycles.
The invariant is the [[Parity of a permutation|parity of permutations]] of all 16 squares (15 pieces plus empty square) plus the parity of the [[taxicab distance]] moved by the empty square. This is an invariant because each move changes the parity of the permutation and the parity of the taxicab distance. In particular if the empty square is not moved the permutation of the remaining pieces must be even. The same argument works for all rectangular boards, or more generally for all boards with no odd cycles.

The converse holds: all even permutations ''are'' solvable,<ref>[http://www.maa.org/pubs/monthly_nov99_toc.html The American Mathematical Monthly, november 1999]</ref> but proofs of this result were hard to find in the mathematical literature ([[Israel Nathan Herstein]] and [[Irving Kaplansky]] even wrote in their ''Matters Mathematical'' book that "No really easy proof seems to be known."), until [[Aaron F. Archer]] presented a short, simple, elementary proof, based on defining [[equivalence class]]es via a [[hamiltonian path]].


For larger versions of the ''n''-puzzle, finding a solution is easy, but the problem of finding the ''shortest'' solution is [[NP-hard]].<ref>Daniel Ratner, Manfred K. Warmuth. ''Finding a Shortest Solution for the N × N Extension of the 15-PUZZLE Is Intractable''. National Conference on Artificial Intelligence, 1986.</ref> For the 15-puzzle, lengths of optimal solutions range from 0 to 80 moves; the 8-puzzle can be solved in 31 moves or fewer (integer sequence [http://www.research.att.com/~njas/sequences/A087725 A087725]).
For larger versions of the ''n''-puzzle, finding a solution is easy, but the problem of finding the ''shortest'' solution is [[NP-hard]].<ref>Daniel Ratner, Manfred K. Warmuth. ''Finding a Shortest Solution for the N × N Extension of the 15-PUZZLE Is Intractable''. National Conference on Artificial Intelligence, 1986.</ref> For the 15-puzzle, lengths of optimal solutions range from 0 to 80 moves; the 8-puzzle can be solved in 31 moves or fewer (integer sequence [http://www.research.att.com/~njas/sequences/A087725 A087725]).

Revision as of 13:02, 10 September 2009

A solved 15-puzzle

The n-puzzle is known in various versions, including the 8 puzzle, the 15 puzzle, and with various names (Gem Puzzle, Boss Puzzle, Game of Fifteen, Mystic Square and many others). It is a sliding puzzle that consists of a frame of numbered square tiles in random order with one tile missing. If the size is 3×3, the puzzle is called the 8-puzzle or 9-puzzle, and if 4×4, the puzzle is called the 15-puzzle or 16-puzzle. The object of the puzzle is to place the tiles in order (see diagram) by making sliding moves that use the empty space.

The n-puzzle is a classical problem for modelling algorithms involving heuristics. Commonly used heuristics for this problem include counting the number of misplaced tiles and finding the sum of the Manhattan distances between each block and its position in the goal configuration. Note that both are admissible, i.e., they never overestimate the number of moves left, which ensures optimality for certain search algorithms such as A*.

Solvability

A simple parity argument shows 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 labeled states into two equivalence classes of reachable and unreachable states.

The invariant is the parity of permutations of all 16 squares (15 pieces plus empty square) plus the parity of the taxicab distance moved by the empty square. This is an invariant because each move changes the parity of the permutation and the parity of the taxicab distance. In particular if the empty square is not moved the permutation of the remaining pieces must be even. The same argument works for all rectangular boards, or more generally for all boards with no odd cycles.

The converse holds: all even permutations are solvable,[1] but proofs of this result were hard to find in the mathematical literature (Israel Nathan Herstein and Irving Kaplansky even wrote in their Matters Mathematical book that "No really easy proof seems to be known."), until Aaron F. Archer presented a short, simple, elementary proof, based on defining equivalence classes via a hamiltonian path.

For larger versions of the n-puzzle, finding a solution is easy, but the problem of finding the shortest solution is NP-hard.[2] For the 15-puzzle, lengths of optimal solutions range from 0 to 80 moves; the 8-puzzle can be solved in 31 moves or fewer (integer sequence A087725).

History

Sam Loyd's unsolvable 15-puzzle, with tiles 14 and 15 exchanged. This puzzle is not solvable because it would require a change of the invariant.

Sam Loyd claimed from 1891 until his death in 1911 that he invented the puzzle. But he had nothing to do with the invention or popularity of the puzzle.[3] 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. Copies of the improved Fifteen Puzzle made their way to Syracuse, New York by way of Noyes' son, Frank, and from there, via sundry connections, to Watch Hill, RI, 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, Dr. Charles Pevey, a dentist in Worcester, Massachusetts, garnered some attention by offering a cash reward for a solution to the Fifteen Puzzle.[3]

The game became a craze in the U.S. in February 1880, Canada in March, Europe in April, but that craze had pretty much dissipated by July. Apparently the puzzle was not introduced to Japan until 1889. The craze was, in part, fuelled by Loyd offering a $1,000 prize for anyone who could provide a solution for achieving a particular combination specified by Loyd.[4] It was later shown by Johnson and Story[5] that no solution to this "14-15 puzzle" was possible as it required a transformation from an even to an odd combination. The extent of the craze exceeded even that of the Rubik's cube in the 1980s.[6] 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.[3]

Miscellaneous

The Minus Cube, manufactured in the USSR, is a 3D puzzle with similar operations to the 15-puzzle.

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

Notes

  1. ^ The American Mathematical Monthly, november 1999
  2. ^ Daniel Ratner, Manfred K. Warmuth. Finding a Shortest Solution for the N × N Extension of the 15-PUZZLE Is Intractable. National Conference on Artificial Intelligence, 1986.
  3. ^ a b c The 15 Puzzle, by Jerry Slocum & Dic Sonneveld. ISBN 1-890980-15-3
  4. ^ Richard E. Korf, "Recent progress in the design and analysis of admissible heuristic functions", Abstraction, reformulation, and approximation: 4th international symposium, Texas, USA, 26-29 July 2000, pp.45-57, Springer, 2000 ISBN 3540678395.
  5. ^ W.W. Johnson and W.E. Storey, "Notes on the 15 puzzle", American Journal of Mathematics, vol. 2, 1879, pp.97-109 (quoted by Korf).
  6. ^ Kevin R. Gue, Byung Soo Kim, "Puzzle-based storage systems", Naval Research Logistics, vol 54, Issue 5, 2007, pp.556-567.

References

  • Archer, Aaron (1999). "A Modern Treatment of the 15 Puzzle", American Mathematical Monthly 106, pp. 793–799.