The Game of Life is a famous game developed by the mathematician John Conway. The rules...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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: diun 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. 2013V 73 de ● ● ● }; Any live cell with two or three live neighbours lives on to the next genera- tion. Any live cell with more than three live neighbours dies, as if by over- crowding. class Cell { public: 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 10 x 10 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. Cell(int x, int y): _x(x), _y(y) {} int getX() const { return _x; } int getY() const { return _y; } private: // (x,y) represents the cell location on the grid int _X; int -y; Game of void Seed void tick boo! get game. Listing 3: Modelling a Cell Come of Life game (10₁ game seed f 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: diun 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. 2013V 73 de ● ● ● }; Any live cell with two or three live neighbours lives on to the next genera- tion. Any live cell with more than three live neighbours dies, as if by over- crowding. class Cell { public: 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 10 x 10 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. Cell(int x, int y): _x(x), _y(y) {} int getX() const { return _x; } int getY() const { return _y; } private: // (x,y) represents the cell location on the grid int _X; int -y; Game of void Seed void tick boo! get game. Listing 3: Modelling a Cell Come of Life game (10₁ game seed f
Expert Answer:
Answer rating: 100% (QA)
The image contains a description and rules for Conways Game of Life which is a cellular automaton devised by the mathematician John Conway It also sho... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Fyre Technology Corp. (FTC) has a WACC of 18% and a corporate tax rate of 35%. FTC is considering installing a new air filter system. The project team comes up with the following numbers: - Initial...
-
The Game of Life is a well-known mathematical game that gives rise to amazingly complex behavior, although it can be specified by a few simple rules. (It is not actually a game in the traditional...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
What is the type of the expressions computed on these two lines? 4 > 5 print (4>5)
-
Find the volume of the solid created by revolving the region bounded by the x-axis and the curve y = 4x2 - x about the y-axis.
-
Firm L had net assets at the end of the year of $365,000. The only transactions affecting stockholders' equity during the year were net income of $56,000 and dividends of $26,000. Required: Calculate...
-
What are the four facets of independence discussed in the chapter? Explain why each is a necessary component of a public accountant's independence.
-
The accountant of Latifa Shoe Co. has compiled the following information from the companys records as a basis for an income statement for the year ended December 31, 2014. Rent revenue...
-
The following standards have been established for a raw material used to make product 084: Standard quantity of the material per unit of output Standard price of the material 6.8 meters $18.90 per...
-
A B D F Dayton, Inc. Annual Income Statement (Values in Millions) Common Size 2012 2011 2012 2011 Sales $ 178,909 $ 187,510 Cost of Sales 111.631 Gross Operating Profit Selling, General & Admin....
-
Lee High, the newly hired cost accountant, computes the variable cost and the fixed cost per unit at a volume of 500 units of Great Heath per week. He uses this information to develop some guidelines...
-
Eagle Outfitter's store in Butte, Montana, is projecting sales as follows: January, \$50,000; February, \$80,000; March, \$40,000; April, \$50,000. Cash sales are \(60 \%\) of total sales; credit...
-
As a part of understanding the control environment, an auditor studies the organization structure as it relates to the division of labor and responsibility. The auditor also studies the accounting...
-
A company plans to have sales of 20,000 in January, 30,000 in February, and 40,000 in March. Cash sales are expected to be 20 percent of the total and the remaining sales are sold on account and...
-
Waterking sells crystal vases. Budgeted sales are \(\$ 40,000\) for March and \(\$ 50,000\) for April. Sales are planned to be \(80 \%\) cash and \(20 \%\) on credit. The balance of Accounts...
-
Waterking sells crystal vases. Budgeted purchases are \(\$ 25,000\) for May and \(\$ 30,000\) for June. Waterking pays for \(60 \%\) of inventory purchases in the month of the purchase and \(40 \%\)...
-
Find the amplitude of y = -2 sin x + 2 sin(x+2)-3 3. Describe the change of this translation, transformation, or shift.
-
Calculate the Lagrange polynomial P 2 (x) for the values (1.00) = 1.0000, (1.02) = 0.9888, (1.04) = 0.9784 of the gamma function [(24) in App. A3.1] and from it approximations of (1.01) and (1.03).
-
Give examples of the following methods from the Java library. a. A method with a double argument and a double return value b. A method with two double arguments and a double return value c. A method...
-
After closing time, the store manager would like to know how much business was transacted during the day. Modify the CashRegister class to enable this functionality. Supply methods getSalesTotal and...
-
What do these code snippets print? a. int result = 0; for (int i = 1; i
-
Determine if 1,034 is prime or composite
-
Find the prime factorization of 140 .
-
How many different prime factors does 10,241 have?
Study smarter with the SolutionInn App