CS 122 - Computer Science II
Assignment 5
The Game of Life
Write a program to display successive generations of the game of life. The game should be
played on a 23 by 79 square matrix. The rules for determining what happens to an organism in the
matrix are as follows. These rules are slightly different than what you were given in class but they
will work better.
- Only one organism per square.
- Any organism with two or three neighbors is stable and will
survive to the next generation. There are enough resources
for all and the isolation is bearable.
- Any organism with four or more neighboring organisms will
die by the next generation because of overcrowding and there
are not enough resources to support survival.
- Any organism with zero or one neighbors will die by the next
generation because of isolation.
- Any square that is unoccupied, but has exactly three
neighboring colonies has just the right conditions to support
a new organism and a new organism will be born into it for
the next generation.
Clear the screen and display the board after each generation is calculated. Your program should
terminate when either no change occurs from one generation to the next or 100 generations has
passed, whichever comes first.