LightsOut

Work on this exercise in the pairs assigned by your instructor, striving to use good principles of Pair Programming. Feel free to ask questions of your instructor, student assistants and classmates as desired. 4>Goals The goals of this exercise are to:

The Exercise

Instructions Part 1 - Demo and Specification

Your instructor will demo LightsOut.

For this assignment you will design and implement a variation of the electronic game "Lights Out." But your virtual game can add features that a physical game could not easily support.

The user will initially be presented with a 5 by 5 (in this case we'll say that numRows=5) grid of buttons, representing lights that are on or off. The object is to end up with all of the lights off. When the user presses a button, the on/off state of that button is toggled, along with all of the "vertically and horizontally adjacent" buttons in the grid. For example, if the user clicks the [2,3] button, then the on/off states of the following buttons are toggled: [2,3], [1,3], [3,3], [2,2], [2,4].

We will do some in-class exercises that will help with various aspects of this assignment.

Detailed specification

You game should meet the following specification:

  1. Your game behaves like the example shown above, with regard to button-clicking and toggling of lights on and off.

  2. Your game has controls (probably buttons) that provide at least the following features:

  3. Your game displays the name of its author.

  4. Your final project is delivered as an applet. (You can write it as an application while beginning development; it's easy to change it to an applet later.)
As always, your project should have a design that is easily extended and an implementation that is clear, per the next section.

In addition, we may have you do a peer review of classmates' projects after the project is turned in.

Instructions Part 2 - Design

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 disgram 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.

Here is an example of a UML class diagram for a game called HiLo.

Instructions Part 3 - Create a basic Iterative Enhancement Plan (IEP)

Software engineers typically implement their projects by using Iterative Enhancement, which means: An Iterative Enhancement Plan is a list (in ordinary English) of the stages. Overall, I recommend working on the array logic first, and leave the GUI enhancements until last.

Instructions Part 4 - Start working on your IEP

You should be committing code via Subclipse to your team's repository at least at the end of every phase of the IEP. Format:

http://svn.cs.rose-hulman.edu/repos/username1-username2

(where the 2 usernames are alphabetized).

Don't forget to check in your final project!