Welcome to roadsat.com on January 7 2009.
This is an internet experiment running to monitor browsing habbits of individuals through wikipedia contents.

Fifteen puzzle

From Wikipedia, the free encyclopedia

  (Redirected from N-puzzle)
Jump to: navigation, search
A solved 15-puzzle

The n-puzzle is known in various versions, including the 8 puzzle, the 15 puzzle, and with various names. 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*.

Contents

[edit] 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.

In the case of a rectangular game of p rows and q columns, with p ≥ 2 and q ≥ 2:

  • if q is odd, the invariant is the parity (odd or even) of the number of pairs of pieces in reverse order (the parity of the permutation). For the order of the 15 pieces consider line 2 after line 1, etc., like words on a page.
  • if q is even, the invariant is the parity of the number of pairs of pieces in reverse order plus the row number of the empty square counting from bottom and starting from 0.

Thus, for the 15-puzzle, an even permutation of the order of the 15 pieces can only be obtained if the empty square is not moved or moved two rows, and an odd permutation of the order of the 15 pieces can only be obtained if the empty square is moved one or three rows.

On the other hand, if we consider boustrophedon ordering (that is, line 1 going from left to right, line 2 going from right to left, and so on) for the order of the pieces (instead of the row-major ordering mentioned above), then for any number of columns, the invariant is the parity of the number of pairs of pieces in reverse order.

By contrast, note that considering the parity of permutations of all 16 squares (15 pieces plus empty square) is not meaningful here, because it changes with every move. Since the parity of the sum of the row number and the column number of the empty space also changes every move, a possible invariant is the parity of (number of permutations of all 16 squares + space row number + space column number). This is an invariant for all rectangular boards.

If playing a solvable version of the 15 puzzle you can take the shortcut of solving the squares 1,2,3,4,5,9 and 13 , you then only have a 3x3 grid to solve. This speeds the process up quite considerably.

[edit] Noyes Chapman's Fifteen Puzzle

Noyes Chapman's unsolvable 15-puzzle, with tiles 14 and 15 exchanged

In its most famous version, the Fifteen Puzzle, initially known as the Gem Puzzle, Boss Puzzle, Game of Fifteen, Mystic Square, and many others, has a 4×4 grid, where in the initial configuration the pieces are in ascending order, except that pieces 14 and 15 are in reverse order. This puzzle is not solvable because it would require a change of the invariant.

[edit] History

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.[1] 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. 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. 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 granted to Ernest U. Kinsey.[1]

For larger versions of the n-puzzle, finding a solution is easy, but the problem of finding the shortest solution is NP-hard.[2]

In the USSR the Minus Cube was manufactured, a 3D variant of the 15-puzzle.

Bobby Fischer was an expert at solving the 15-Puzzle, provided that it was in a configuration that could be solved. 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.

[edit] See also

[edit] Notes

  1. ^ a b The 15 Puzzle, by Jerry Slocum & Dic Sonneveld. ISBN 1-890980-15-3
  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.

[edit] References

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


[edit] External links

Personal tools

Visit joltnews for the latest headlines
Visit bloit.com for company information
Geed Media does computer consulting on long island.
This page viewed times. See Logs