CS 1713 Section 3, Spring 1997
For this assignment, you will implement John Conway's "Game of Life."
This is a "game" with no players in which a board (represented by a
two-dimensional array) contains cells that are either on or off. At
each time step, certain rules govern what happens to these cells; their
birth, life, and death.
Assignment 7: Two-dimensional Arrays: The Game of Life
The board for this program will be 79 columns across by 24 rows down, so
that it can be easily printed on a VT320-like terminal. You will read
the initial configuration of the board in from a file containing
blanks and x's; the blanks represent "off" cells and the x's
represent "on" cells. The files will each have 24 lines of 79 characters
each. The name of the file will be specified on the command line.
Your program will apply the following rules to play the game of life:
A cell has a neighbor if any adjacent cell is on. For instance, the
cell at (5, 6) has a neighbor if the cell at (5, 7) is on. It has two
neighbors if the cell at (6, 6) is also on. There are eight cells
adjacent to each position, except for positions on the boundaries, e.g.,
- A cell is turned on (born) if it has exactly three neighbours.
- A cell dies of loneliness, if it has fewer than two neighbours.
- A cell dies of overpopulation, if it has more than three neighbours.
- A cell survives to the next generation, if it does not die of loneliness
Your program should do the following:
You will find several files containing initial configurations on runner
On a VT100/VT320 compatible terminal, you can clear the screen with the
following C statement:
- Read the initial configuration from the file named on the command line.
- Clear the screen, print the board and then play one round of the game.
- Repeat the previous step 100 times.
Turn in the assignment by e-mailing it to the instructor. For your
progress report, write about what happened when the game played on each
file; some games will end up in "stable" configurations where nothing happens,
and others will oscillate with interesting patterns.
This assignment is due Monday, April 7 1997 at midnight.