/8-Puzzle

An 8 puzzle is a simple little game consisting of a 3 x 3 grid (containing 9 squares). One of the squares is empty. This allows you to move the other squares around into different positions.

Primary LanguageJava

8-Puzzle

An 8 puzzle is a simple little game consisting of a 3 x 3 grid (containing 9 squares). One of the squares is empty. This allows you to move the other squares around into different positions. The first image to the left might be thought of as a "solved" 3 x 3 8 puzzle. The second image might be thought of as an "unsolved" 8 puzzle.

The terms "solved" and "unsolved" are completely arbitrary here. What is important is that a puzzle in a given "state" must be transformed into another state through a series of "moves." Given that there is only one space on the puzzle board, only one square can be moved at a time. Any such a move yeilds a new "state." It should be noted that (perhaps obviously), puzzles need not be limited to 3 x 3 in size.