CS 246 Homeworks 6 & 7:  Conway's Game of Life

You MUST work with at least one other person on this assignment, and may work with up to two.  If you choose to have a three-person team, I expect your project to be suitably more sophisticated than a two-person team.

Homework 6 Due:   Monday, April 22, 2013
Homework 7 Due:
  Wednesday, May 1, 2013
 
Please read the homework guidelines before you proceed.


Project Description

Conway's game of life is a cellular automaton and popular example of Artificial Life.  It consists of a set of binary cells that obey specific rules at each timestep and grow, die, or evolve over time.  Given an initial configuration of binary cells, the system evolves automatically over time. 

In this project, you will implement Conway's game of life in C++.  You may use text-based output or 2D graphics to show the state of the simulation.

You are welcome and encouraged to read external material on Conway's game of life and appropriate data structures, but you may not use code from or consult any implementations of the game of life or those data structures.

This assignment will be divided into two parts, one of which will count as homework 6 and the other as homework 7.


Requirements



Command Line Arguments

Your implementation must accept the following command line arguments:

The default (no arguments) functionality should be to use a 100,100 torus initialized randomly.


Grid Topologies

The number of rows and columns in the grid stays fixed throughout the game, as specified by the command line arguments.  Your implementation should support three different grid topologies, which determine the neighbor cells along the border of the grid:

Cylinder: The cylinder wraps around horizontally, with the left border being adjacent to the right border.  For example, the column of cells on the left side of the grid act as if they were bordered on the left by the column of cells on the right side of the grid, and vice versa.  The top and bottom borders act as if they are bordered respectively above and below by always-dead cells.

Moebius strip:  Like a cylinder, but with the left column identified with the reverse of the right column. That is, the top left square is the neighbor to the right of the bottom right square. The square below the top left square is neighbor to the right of the square above the bottom right square. And so on until the bottom left square, which is the neighbor to the right of the top right square. Note that these conventions also determine diagonal neighbors of border squares.

Torus:  Like a cylinder, but instead of having the top and bottom rows bordered by always-dead cells, the top and bottom rows link together.  That is, the grid wraps around both horizontally and vertically.


Speed

You will need to be clever to avoid performance issues. While it is possible to implement the game of life entirely as a 2D array, it will be very expensive to iterate over the entire 2D array each timestep.  Instead, you should store cell states in a data structure (red-black tree, KD-tree, or one of your own choosing/design) to facilitate efficient lookup.  It may help to name cells by their coordinates, and to store the names or pointers to neighboring cells to facilitate rapid lookup of their state.  To keep memory from getting out of hand, you will probably want store only live cells in the structure.


Homework 6 Submission

For your homework 6, you must submit a very clear design document for the full project.  This design document will have a strict 4 page limit (1in margins, 11pt font), and must specify:

Your design document must convince me that I should let you build this program.  I expect the design document to be very concise and packed with detail.  I strongly recommend that you write it out as a 7-8 page document initially and then compact it like crazy.  (Yes, I really do expect you to compact 7-8 pages of material into a four page report.)

You should also submit an initial version of your implementation, and describe its status in the design document.  I recommend that you start with a very basic version of the game of life using a 20 x 20 torus, storing everything in only a 2D array (e.g., don't support command line arguments, efficient data structures for quick lookup, etc.).  At this initial stage, don't worry about visualizing the game, just output status information.  There are no strict requirements for this initial implementation, but it must convince me that you will be able to finish the entire program.


Homework 7 Submission

For your homework 7, you should submit a completed project as well as a two page report (again, this is a strict limit using 1in margins and 11pt font).  Your report should again be very detailed and concise, explaining:


Submission

Submit one assignment for all partners, following the assignment guidelines and submission instructions.  You will do this once for Homework 6 and once for Homework 7.

Be sure to list all partners' names in your README file. 

Provide a working Makefile for your assignment.  The Makefile should support four commands:  make, make run, make run_custom, and make clean.  I must be able to:

  1. Uncompress your submission
  2. "cd" into the directory
  3. Type "make" and have your program compile itself.
  4. Type "make run" and have it launch itself with the default arguments
  5. Type "make run_custom" and have it launch itself with arguments of your own choosing (unnecessary for the HW6 version)

Put all source code, the data files, the README, your written report, and Makefile into a single .tar.gz file.

Additionally, each partner should also submit an independent and private brief statement via e-mail to Eric that describes each partner's contribution to the project.  Use the subject "CS246 HW6/HW7 Partner Work Distribution".

  

Hints