Learn how to use pointers
For this assignment you will be implementing the classic cellular automata of Conway's Game of Life.
1. A new cell is born on an empty square if is surrounded by exactly three neighboring cells
2. A cell dies of overcrowding if it has four or more neighbors
3. A cell dies of loneliness if it has zero or one neighbor
4. Any live cell with two or three live neighbors lives, unchanged, to the next generation.
The initial state of the game is held in a text file named the driver code and attached to this assignment (you must use this driver program). The format will be sequences of ones and zeros. A one means that a cell is living in that square. You will determine the size of the grid display by reading the first line of the text file and seeing how many columns you will need. You will determine the number of rows in the grid by counting the lines of data.
The grader will use a file with arbitrary grade size to grade the project. You algorithm should be able to handle this.
Example: Jeremy Allen's Glider Gun fight grid (set the iterations to 500).
Note: When printing out the status of the grid, print one character to standard output per cell in the automaton. You may use whatever characters you wish to show the status of the cell. The driver program will clear the screen between generations.
In this project you will have three files -
1) "life.h" will store the prototypes of all functions that are employed in the workings of Game of Life
2) "life.cpp" will store all headers and definitions of the functions identified in "life.h"
3) "life_driver.cpp" - this is a given file that tests the functionality of your game of life.
To compile all three files you need to add them to a project in
Dev C++ environment.
( THE FILES ARE BELOW AT THE END OF THIS ASSIGNMENT.)
Note: when you submit your life.h and [url removed, login to view] they should work with default [url removed, login to view] file.
It means that you cannot make any changes to [url removed, login to view] except the value for
NUM_GENERATIONS for debugging purposes.
NOTES: DO NOT USE "CLASS" THAT IS USED IN DATA STRUCTURE. AND PLEASE DO NOT USE STRING. USE CHARACTERS INSTEAD OF STRINGS.
1) Code compiles
2) Following functionality is tested
a. ShowWorld() function works correctly
b. iterateGeneration() function works correctly, i.e., correct cells become alive and
correct cells die
c. the program can handle input of an arbitrary size by using two dimensional
3) Comments are present in the code
4) Code styling margins (lines of the code are not too long), readability (code is not
cluttered and follows style standards for the class )
5) Code efficiency: code is concise and no unnecessary conditional, interactive and
sequential statements are employed considering the implementation requirements and
constraints outlined by the project
Penalty: (SO THINGS TO AVOID)
1) Non-default [url removed, login to view] has to be employed for the program to work
2) Dynamic arrays should go and shrink with each generation as new live cells appear and
disappear. Only single boundary of dead cells around the live cells is allowed when the
new generation is displayed or written to a temporary file. If this functionality is not
3) If string objects are used