Arrange Numbers Puzzle

Use graphics.py. It is a simple graphics library. Click HERE for more information. (download, install, documentation, ...)

Project #1

Create an interactive puzzle in a graphics window. It consists of cells containing numbers. To win, the user must arrange the number cells in a specific order.

There is one blank cell. This cell can swap places with an adjacent numbered cell.

Clicking on a numbered cell adjacent to (touching) the blank cell will cause the cells to swap place. (Touching blank cell's top, bottom, left, and right. What about diagonals? What about only diagonals?)

When the puzzle is complete a congratulations message is displayed. The number of moves (swaps) is also displayed.

See the "Sample Puzzle Layout" below.

Design Thoughts

  1. Controls available to the user
    • start the puzzle?
    • restart/reset the puzzle?
    • start a new puzzle?
    • quit the puzzle?

  2. save the puzzle
    • save the current state of the puzzle so the user can stop in the middle and come back later?

  3. Number of cells and puzzle layout
    • number of cells is fixed or the user selects the number of cells?
    • the layout is fixed or the user selects a layout from several available?

  4. On puzzle start
    1. if multiple puzzle layouts are available, one is randomly selected.
    2. a random cell is selected to be the blank cell.
    3. numbers are randomly distributed to the other cells.
    4. the puzzle and controls are displayed in a graphics window.

  5. The puzzle's cells do not need to be arranged in a rectangle. How about a Diamond? A triangle? ...?

Sample Puzzle Layout