Question
You will design, implement, and test a program that runs the game of life in C++. Conways Game of Life is a standard example of
You will design, implement, and test a program that runs the game of life in C++. Conways Game of Life is a standard example of a cellular automaton. This means that you have an array or matrix of cells. Each turn or generation the value of each cell may change based upon its neighbors. he rules are: Each cell has eight neighbor cells. The neighbors are the cells directly above, below, to the right, to the left, diagonally above to the right and left, and diagonally below to the right and left. 1. If an occupied cell has zero or one neighbor, it dies of loneliness. 2. If an occupied cell has more than three neighbors, it dies of overcrowding. 3. If an empty cell has exactly three occupied neighbor cells, there is a birth of a new cell to replace the empty cell. 4. Births and deaths are instantaneous and occur at the changes of generation.
There are significant initial questions that you must address in your design. We will limit the visible world to 40 x 20 cells. Thats a lot of characters to type in from the keyboard so dont make the user do it. You must give the user the option for one of three starting shapes in the grid; an oscillator, a glider, and a glider cannon.
You will need to handle the cells on the edges. Remember this is a window on an infinite grid. The patterns go on forever. You are just showing them while they are visible in this small window. You may not be able to just stop the patterns at the edge as that may change the behavior. Specifically, any pattern should not change as the object moves out of the visible grid.
After you have everything designed, coded, and tested add an option for the user to specify the starting location of the selected pattern. They will specify a single cell. Make it clear which cell of the pattern they are using. Otherwise they could put a glider at an edge and the glider moves away and they never see it!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started