The deadline for this lab is Tuesday 18 April 2006, 15:45:59 hours. Strictly no submissions will be accepted after the deadline.
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
... *** ...
First, we apply rule 1 and mark all the dead / empty cells that are "going to be born":
.@. *** .@.
Then, we apply rule 3 and mark all the live cells that are "going to die" (in this case they die due to "loneliness"):
.@. X*X .@.
Note that when counting the number of neighbours for a live cell, it is dependent on how many current live neighbours it has. In another words, the neighbouring dead / empty cells that are "going to be born" (those marked with a '@') do not affect if a live cell is "going to survive or die".
Finally, we replace all '@' with '*', and replace all 'X' with '.'
.*. .*. .*.
The above is the next generation and is called generation 1. Subsequent generations are called generation 2, generation 3, etc.
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15
The board is a 20 x 20 board. The first twenty lines consist of the board layout, with 0 used to represent a dead / empty square, and 1 used to represent a square that is alive. This is followed by a single number (which we call n) that represents the nth generation we wish to display.
Generation 0: .................... .................... .................... .................... .................... .................... .................... .................... .................... .........***........ ..........*......... .................... .................... .................... .................... .................... .................... .................... .................... .................... Generation 15: .................... .................... .................... .................... .................... .................... .........***........ .................... .......*.....*...... .......*.....*...... .......*.....*...... .................... .........***........ .................... .................... .................... .................... .................... .................... ....................
You are reminded to follow the sample output exactly; else marks will be deducted.
Do not use any structures in your program, else no credit will be given.
Remember to submit your program using the submit life.c command, and check your submission using the check command.
All the best!