COSC.497.001, Spring 2005
C++ For Game Developers
Yoram Chisik  

Assignment 4
The Game of Life


--- Class Links ---
Course Syllabus


The Exercise:

On a chessboard, each square represents a cell which is either alive or dead. If you count the sides which a cell shares with other cells, then each cell is in touch with four neighbours (unless it is at the edge of the board).

Write a C++ program that uses a matrix with n*n elements to represent the cells, where n=45. First the program marks the cells on the two diagonals as alive and the rest of the cells as dead. The program then scans the board n times. During each scan, it updates all the cells as follows: If a cell has one, two or three living neighbours the cell is marked as alive; otherwise it is dead. Notice that this rule permits dead cells to become alive.

After each iteration create an image of the board in which each cell is printed as an asterix if it is alive and as a space if it is dead. This time we are going to write the board to a file instead of diaplaying it on the screen as we have done so far. When the program completes its execution you will have a file with 45 images of the board showing the progression of your automaton simulation.

instructions on how to write to a file

Deliverables

  • A stepwise programming description of your approach to developing the simulation
  • C++ source file for the application (no need to include an exe file)
  • The file with the images of the board generated by your program. The file should contain your name and assignment number

Submission Guidelines

  • All written work such as the stepwise description should be submitted in digital form as a webpage, word document or adobe acrobat (pdf) file.
  • code should be well formatted, i.e. using white space, tabs and parentheses to make the code easy for the eye to see and read.
  • code should be well commented, its not enough for your application to work, I want to see your thought processes so include copious comments in your code explaining the choices you have made and the reasoning behind them.
  • Application should compile on Dev-C++ IDE on Windows XP

Due date

  • All files should be loaded to your folder on student-iat.ubalt.edu before the start of class on 04/13/05.
  • create a folder for assignment 4 and place all submission files there

Updated 2/15/05