LightsOut

Objects, classes, event-driven programming and arrays

In LightsOut you will experience:

  1. The software design process, including:

  2. Using object oriented programming to create complex behavior. In particular, using:

  3. Development in a graphical user interface (GUI).

  4. Event-driven programming and the Swing extension to the Abstract Windows Toolkit (java.awt).

Individual work

Do LightsOut by yourself, so that you can be confident that you have mastered its ideas. However, feel free to seek help from assistants and classmates.

As with all your individual work, if you get help:

Overview

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

Play with the sample implementation to get an idea of how the game works.

We will do some in-class exercises that will help with various aspects of this assignment. You will have some time in class to work on this project.

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 application.
As always, your project should have a design that is easily extended and an implementation that is clear, per the next section.

What to do

You will create this project by applying the software engineering principles:

  1. Stage0 contains:

  2. Stage1Stub and Stage1 implement stage 1 of your iterative enhancement plan, where:

  3. Stage2Stub and Stage2 implement stage 2 of your iterative enhancement plan, and so forth.

  4. StageFinal is the final versions.

  5. You can, and normally should, have several CVS versions for each stage.

  6. Please take care to name stages exactly as stated above.

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

Deadlines

The last two deadlines are firm. It would be wise to be ahead of the above schedule.