CMPU 102 - Assignment 3 Due: by 11:59 PM on Thursday, September 22nd

In this assignment, you will implement Conway's Game of Life.  Life is a simulation of simple one-celled organisms.

Cells either live or die according to the Rules of Life:

A simple GUI is provided so that you can visualize the progress of the successive generations of organisms.

Your task is to implement the class GameBoard which represents one generation of cells.  The board is a two-dimensional grid of cells, where each cell contains an integer value.  The value of a cell is either 0, meaning that the cell is dead, or some positive integer representing the number of generations that the cell has been alive.

Methods to implement

You will implement the following methods in the GameBoard class:

Getting started

Start by importing the file life_fixed.zip into Eclipse using the same procedure you used in Lab 1: from the menu, choose "File->Import->Existing Projects into Workspace", click "Select archive file", select "life_fixed.zip" from the file selection dialog, and then click the "Finish" button.

The LifeGUI class has a main method that will start the GUI interface.  This webpage describes how to configure Eclipse to run LifeGUI's main method.

The Random button creates a new random game board.  The One Step button applies the Rules of Life to the current game board; therefore, it is a good way to test your implementation of the GameBoard class.  Once you have GameBoard working, you can use the Animate button to play a sequence of generations, 3 generations per second.  The Load button will use your implementation of the loadFromFile method to load a new game board.  Some sample files are provided in the "handouts" folder in your project: for example, "glider.life" initializes the board to display a single glider pattern, which evolves in an interesting way.  (Note that when you run the GUI, the file chooser will start in your home directory.  To get to the sample files, look in the "eclipse-workspace/life/handouts" directory.)

Here are some additional patterns you can try:

Submitting the project

To submit the project, type the following commands in a terminal window (hitting return after each command):

cd
cd eclipse-workspace
submit102 life

You may submit as many times as you wish.  The final submission prior to the deadline will be graded.