The Game of Life
The mathematician John Conway devised the game of life to simulate population growth. It is not really a game but an example of a mathematical genre called cellular automatons. The game of life gained much popularity after its introduction by Martin Gardner in his column in Scientific American. There are many web sites dedicated to the many interesting configurations used in this game. This lab will implement a modified version of this game. Here are the rules.
Start out with a grid of squares.
Each individual square has eight neighboring squares, except those at the sides and corners.
Each square represents a “critter” of some sort that can be alive or dead.
Each grid represents a population of these critters. The grid changes from generation to generation according to the following rules:
If a square is dead and has exactly 3 living neighbors it comes to life in the next generation.
If a square is already alive and it has exactly 2 or exactly 3 living neighbors it survives into the next generation. Otherwise it dies.
If a living square has four or more living neighbors it dies due to overcrowding.
To understand how the game of life is played check out: http://www.bitstorm.org/gameoflife/ or you can Google “game of life” to download any number of versions of this game. The Wikipedia page is also very informative. http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life
Your assignment is to modify the lifeclass to program the game of life. Use a grid of 20 rows by 60 columns
const int maxrow = 20, maxcol =
60; // grid dimensions
To see how this program
should work, click here to see
the glider
pattern. Click here to see
the tenline pattern
9. Try your code with the
following two sets of data.
GLIDER
8 6
9 7
10 5
10 6
10 7
TENLINE
10 11
10 12
10 13
10 14
10 15
10 16
10 17
10 18
10 19
10 20