The Game of Life

EE312

Due: Friday 2/15/19 at 6:00pm
100 points

For this assignment you will be implementing the classic cellular automotan Conway's Game of Life.

Rules

The initial state of the game will be held in a text file. The format will be sequences of ones and zeros (characters). A '1' means that a cell is alive in that square. You will determine the number of columns in the grid display by reading the first line of the text file and seeing how many characters are in the string. You will determine the number of rows in the grid by counting the lines of data. You will need to know the number of rows and columns in order to dynamically allocate memory for the subsequent iterations of the world.

Here is an example of what a world might look like. This grid may be of arbitrary size, but the number of columns will be the same for every row.

00000000100000001010
00000000010000001001
11100000010100000010
10100100101010101010
00101010010010101000

When printing out the status of the grid, print one character to standard output per cell in the automaton. Use an asterisk (*) to show that a cell is alive and a period (.) to show that the cell is dead.The driver program will clear the screen between generations.

The name of the input file and the number of iterations will be passed as parameters to the main function. Here is an example of how the program will start:

<linux_prompt>% ./life starting_grid.txt 250

Where the name of the executable program is "life", the input file is "starting_grid.txt", and the number of iterations is 250.

NOTES: 

Turn in: life_driver.c, life.c, life.h (you can use the makefile that we are providing).

Upload: Turn in a zipped file named prog02_xxxxx.zip where xxxxxx is your UT EID to Canvas.

Be sure to follow the style standards for the course. 

 

rlp 1/29/19