Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please assist with c++ langua Question 4 The Game of Life is a famous game developed by the mathematician John Conway. The rules are simple
please assist with c++ langua
Question 4 The Game of Life is a famous "game" developed by the mathematician John Conway. The rules are simple but result in a variety of continuously evolving patterns. Wikipedia explains the game as follows: The universe of the Game of Life is a two-dimensional grid of square cells, each of which is in one of two possible states, alive or dead. Every cell interacts with its eight neighbours, which are the cells that are horizontally, vertically, or diagonally adjacent. At each step in time, the following transitions occur: - Any live cell with fewer than two live neighbours dies, as if caused by under-population. - Any live cell with two or three live neighbours lives on to the next generation. Any live cell with more than three live neighbours dies, as if by overcrowding. - Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction. The initial pattern constitutes the seed of the system. The first generation is created by applying the above rules simultaneously to every cell in the seed births and deaths occur simultaneously, and the discrete moment at which this happens is sometimes called a tick (in other words, each generation is a pure function of the preceding one). The rules continue to be applied repeatedly to create further generations. Provide all the source code necessary for modelling a tick in the Game of Life that will produce a new generation. You may assume that the size of the board is 1010 and is already seeded. Cells which lie along the boundary of the board will have less than eight neighbours. The skeleton of a class modelling a cell is given in Listing 3 . You must use this in your solution but you may add additional functions and data members as required. You may also create additional classes as needed. class cell \{ public: Cell (int x, int y):x(x),y(y) \{\} int get x() const { return x;} int gety() const { return y;} private: II (x,y) represents the cell location on the grid int x; int y; \}; Listing 3: Modelling a CellStep 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