Assignment 3: The Game of Life


CS 2308

Due: Friday 3/13/15 at 10:00pm


For this assignment you will be impelementing the classic cellular automotan Conway's Game of Life.

Rules

  1. A new cell is born on an empty square if is surrounded by exactly three neighboring cells
  2. A cell dies of overcrowding if it has four or more neighbors
  3. A cell dies of loneliness if it has zero or one neighbor
  4. Any live cell with two or three live neighbors lives, unchanged, to the next generation.

The initial state of the game will be held in a text file provided by the driver program (you must use this driver program). The format will be sequences of ones and zeros. A one means that a cell is living in that square. You will determine the size of the grid display by reading the first line of the text file and seeing how many columns you will need.  You will determine the number of rows in the grid by counting the lines of data.

00000000100000001010
00000000010000001001
11100000010100000010
10100100101010101010
00101010010010101000

This grid may be of arbitrary size.

Jeremy Allen's Glider Gun fight grid (set the iterations to 500).


When printing out the status of the grid, print one character to standard output per cell in the automaton. You may use whatever characters you wish to show the status of the cell. The driver program will clear the screen between generations.


  • You may do this program as an individual or with one partner.
  • This program must be done using a Linux environment. Note: Your code must compile and run on one of the available linux servers (e.g.hercules.cs.txstate.edu).
  • The program must be modular, with significant work done by functions. Each function should perform a single, well-defined task. When possible, create re-usable functions. Do not write trivial functions such as a function to read a single value from an input file.
  • You must place appropriate functions in a library. You will be creating the life.h header file in such a way that it works with the life_driver.cpp
  • You must name your C++ source files life_xxxxxx.cpp (or life_xxxxxx_yyyyyy.cpp) and life.h, where xxxxxx is your TXstate id number. Make sure you comment the header file well.
  • Please upload one copy with two names if you choose to use a partner.
  • Upload:  the source file(s) only, on TRACS.

    Be sure to follow the style standards for the course. 


    Updated: 3/4/15