Fifteen  

Work on this exercise with a partner, using pair programming. Both partners should participate fully in ALL aspects of the project.

Goals

The goals of this exercise are to apply and hence reinforce your understanding of:

Overview

You will design and implement a computer version of the 19th century puzzle called the Fifteen Puzzle.
  • See the Wikipedia article on the Fifteen Puzzle for a description of the puzzle.
  • You will implement by using:
    • pair programming
    • documented stubs
    • user stories
  • Deliverables, as described below, include a UML class diagram, user stories, html javadoc-generated documentation, and your code.
Solved Fifteen Puzzle

Specification

  1. Basic gameplay. Your program must:
    1. Display a random but solvable 15-puzzle.
      • The display does not have to look exactly like the picture above. Be creative.
    2. Allow the user to move tiles in an attempt to solve the puzzle.
    3. Display a congratulatory message when the user solves the puzzle.
  2. User interface. Your program must allow the user, via a well-designed user interface of your own choosing, to do the following:
    1. Display a new, random but solvable, game.
    2. Change the puzzle from the current dimensions (initially 4 by 4) to an m by n puzzle, for any reasonable m and n.
      • Changing dimensions should cause a new, random but solvable, puzzle to be displayed.
    3. See the names of the authors of the program, as well as a brief bio for each.
    4. Undo the previous move, or redo the previous undo.
      • Multiple undo's/redo's, all the way back to the beginning of the player's attempted solution to the puzzle, should be allowed.
    5. Reset the puzzle to the initial configuration.
  3. Implementation requirements. Your program must:
    1. Use Swing components
    2. Have a clearly documented, object-oriented design that could be easily extended to incorporate additional features
    3. Have code that is clear, is easily extended, and obeys Sun's code conventions
      • In Eclipse, Source ~ Format enforces these code conventions
    4. Be reasonable in its use of space and time
    5. Feature a good GUI design -- use common sense and perhaps look at Ben Shneiderman's Eight Golden Rules of Interface Design and/or Gerd Waloszek's Golden Rules for BAD User Interfaces
      • As an aside: the presentation of Schneiderman's Eight Golden Rules, per the above link, is part of the way-cool Case of the Killer Robot case study on Software Engineering ethics.
    6. Be implemented by using documented stubs and pair programming and user stories.
  4. Additional functionality. You may implement additional features if you wish, but you receive full credit simply for the above.

Instructions

Checkout

Check out your project from your team repository; it's name is given here.

Design

UML
This project requires some interesting design decisions. UML is a great tool to do this. Your instructor will have you go to a whiteboard with your partner (and maybe another pair) to brainstorm which classes we'll need and how each one needs to know about each other. Your UML diagram must have the names of the classes and the relationships (IS-A, HAS-A) between them. You might also find it helpful in some cases to add some more details: the fields and methods of each class, and even the types of the fields, methods and method parameters.
User stories
A user story is simply a statement of a behavior that your program will exhibit when it is run by a user. Any user story can always be tested by running the program. For example,
When the user drags the slider to change the number of rows, the appropriate number of new buttons will be created and the board will be reset into a solved state.
Note that it cannot refer to code (because that's not testable by running the program). So "completed the FifteenButton class" isn't a user story. You must list your user stories in the order in which you plan to implement them. (If you want an example of how they build on each other, see the Swing project we did in class.)

Coding

Prioritize your user stories and code them up one at a time. You'll probably want to commit your work at least after each one, although this will depend somewhat on how complex the code for each user story is.

Deliverables

You should place the following into your project folder:
  1. Your code.
  2. A PDF document called FifteenUML that is your UML class diagram.
  3. A text document called FifteenUserStories listing your user stories.
All of the above should be committed frequently. You may have additional documents in your repository if you wish, for example a UMLet or Violet class diagram, but we will examine only the documents above and your Eclipse project.

Grading Rubric here.