Department of Computing Science Umeå University

Assignment 1 - Game of Life

Due: 2008-06-20, 10:00

The assignment shall be solved individually.

The purpose of this assignment is to introduce the basic model of web development used in JSP, the mechanisms of HTML requests, and the methodology for server-side web development used in the course.

In this assignment, you will develop a web interface for an implementation of Conway's Game of Life. The Game of Life is a simple cellular automaton where cells in a matrix are populated and repopulated using a set of simple rules for cell survival. As this is an introductionary excercise in how to develop web interfaces in JSP rather than a coding excercise for cellular automata, an engine for computing state transitions in the world matrix is provided. A demonstration applet is also provided to demonstrate the game graphically. Should you prefer to run the demonstration as a Swing application, you can do so with the command

  java -jar gameoflife.jar
Your task in this assignment is to create a web-based HTML interface for the game. The exact design of the interface is up to you, but it is recomended that you use HTML tables with square cells, small cell paddings, and table cell backgrounds for cell population markings.

Laboration environment

Download gameoflife.jar and place it in your web applications library directory (5dv093/username/web/WEB-INF/lib).

This JAR-file contains a simplistic game engine implementation of Conway's Game of Life that can be used to compute state transitions for a simple Game of Life world. The engine is provided in a Java package called gameoflife which contains the following classes:

gameoflife.GameOfLife                      <- the Game of Life state engine
gameoflife.GameOfLifeApplet                <- the Game of Life applet
gameoflife.GUI                             <- a graphical interface used by the applet and the application
gameoflife.World                           <- a representation of the Game of Life world state

Using the engine:

To create and initialize a world:

  int width = 50;
  int height = 50;
  World world = GameOfLife.getRandomWorld(width,height);
To serialize and deserialize world states:
  String state = GameOfLife.serialize(world1);
  World world2 = GameOfLife.deserialize(state);
To compute a new world state from an old one:
  World newWorld = GameOfLife.iterate(oldWorld);
To determine world size and check for life in cells:
  int width = world.getWidth();
  int height = world.getHeight();
  boolean life = world.getCell(x,y);

See the environment page for details on installing and using the laboration environment.

Examination

Place a WAR-file containing your solution in

~/edu/5dv093/assignment1/

Java source code should be placed in

~/edu/5dv093/assignment1/src/

You laboration report should be placed in

~/edu/5dv093/assignment1/report/

Due date

2008-06-20, 10:00

http://www.cs.umu.se/kurser/5DV093/SOM-08/assignments/1/index.html
Ansvarig för sidan: P-O Östberg
Senast ändrad 2008-06-18