4. Game of Life (5 marks), coding style (1 mark) Write a gameoflife (x_cycle) function to...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
4. Game of Life (5 marks), coding style (1 mark) Write a gameoflife (x_cycle) function to simulate the game of life based on a given initial population, origin, represented as a list of lists and returns the final population (list) after x_cycle number of cycles. Please refer to the Wikipedia page on Game of Life at https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life and read the sections headed "Rules" and "Examples of patterns". For a cell on the edge of the world, the neighbours outside the world are considered dead. In the end, return final population (the list). Make sure to only return the list and nothing else is printed. Name the file for this program as cwk1d.py. origin = [[0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 01, [0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 01, [0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 11, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0], 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, [0, 0, 0, *in python [0, 0, 0, 0, [1, 1, 1, 0, [0, 0, 0, 0, [0, 0, 0, 0, [0, 0, 0, 0, [0, 0, 0, 0, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, [0, 1, 1, 0, 0, [1, 1, 1, 1, 0, [1, 1, 0, 1, 1, [0, 0, 1, 1, 0, [0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 0, 0, 01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 01, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 01, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 0, 0, 0, 0, 0], 0, 0, 0, 0, 0, 0], 0, 0, 0, 0, 0, 0], 0, 0, 0, 0, 0, 0, 0, 0, 0, 01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 0, 0, 0, 0, 0, 0, 0, 0, 0, 01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 011 4. Game of Life (5 marks), coding style (1 mark) Write a gameoflife (x_cycle) function to simulate the game of life based on a given initial population, origin, represented as a list of lists and returns the final population (list) after x_cycle number of cycles. Please refer to the Wikipedia page on Game of Life at https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life and read the sections headed "Rules" and "Examples of patterns". For a cell on the edge of the world, the neighbours outside the world are considered dead. In the end, return final population (the list). Make sure to only return the list and nothing else is printed. Name the file for this program as cwk1d.py. origin = [[0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 01, [0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 01, [0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 11, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0], 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, [0, 0, 0, *in python [0, 0, 0, 0, [1, 1, 1, 0, [0, 0, 0, 0, [0, 0, 0, 0, [0, 0, 0, 0, [0, 0, 0, 0, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, [0, 1, 1, 0, 0, [1, 1, 1, 1, 0, [1, 1, 0, 1, 1, [0, 0, 1, 1, 0, [0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 0, 0, 01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 01, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 01, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 0, 0, 0, 0, 0], 0, 0, 0, 0, 0, 0], 0, 0, 0, 0, 0, 0], 0, 0, 0, 0, 0, 0, 0, 0, 0, 01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 0, 0, 0, 0, 0, 0, 0, 0, 0, 01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 011
Expert Answer:
Answer rating: 100% (QA)
Answer Here is a simple Java implementation of the Game Of Life Grid is initialized with 0s represen... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
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...
-
Case Study: Quick Fix Dental Practice Technology requirements Application must be built using Visual Studio 2019 or Visual Studio 2017, professional or enterprise. The community edition is not...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
The accounting records of Shinault Inc. show the following data for 2017 (its first year of operations). 1. Life insurance expense on officers was $9,000. 2. Equipment was acquired in early January...
-
Riley Holdings Corp. incurred the following expenditures: $3,100 cost to replace the transmission in a company-owned vehicle; $16,400 cost of annual property insurance on the companys production...
-
Point out which costs in the preceding question are considered "relevant" and which are considered "irrelevant" to a business decision. Explain why.
-
Tristate Recreation Park (TRP) finances operations with both bonds and stock. Suppose TRP issued \(\$ 200,000\) of 10 -year, \(6 \%\) bonds payable under various market conditions. Match each market...
-
Weinstein, McDermott, and Roediger (2010) report that students who were given questions to be answered while studying new material had better scores when tested on the material compared to students...
-
Brothers Herm and Steve Hargenrater began operations of their tool and die shop (H & H Tool) on January 1, 1987, in Meadville, PA. The annual reporting period ends December 31. Assume that the trial...
-
Sally deposits $4,000 in a certificate of deposit that pays 2.12% simple interest. What is her balance after 1 year?
-
Estimation for the inventory holding cost rate, Mokia currently does not have an accurate estimate for its inventory holding cost rate. However, the management thinks that the following historical...
-
For the following game (Player 1 chooses T or B): CR 2,2 0,3 1,2 3,1 1,0 0,2 payoffs L T B (a) (5pts) Find and eliminate any pure strategies that are strictly dominated by mixed strategies. You must...
-
What can be proposed method and limitation of Construction management ? Also Practical and ethical considerations for Construction management ? Reference- Image provided. Proposed Method and...
-
Construction Management legal issues requires professional attention. Case #5 Mega Manufacturer, Inc. (MMI) sought to build a new factory. MMI retained Awesome Architects, Inc. (AAI), an...
-
Describe a graph that shows the impact of a higher demand for workers in Construction Management. ?
-
Calculate the annual allowable depreciation deductions for Ashley for the year ended 31 March 2020, assuming that she wishes to maximise the amount claimed for depreciation for tax purposes. Your...
-
As a marketer, what is most effective post type of advertisement online? why? (i.e., video, photo, etc.)
-
What is master production scheduling and how is it done?
-
Suppose (N t ) t 0 is a Poisson process with parameter . For s < t, find Cov(N s , N t ).
-
Let X Beta(a, b). For s < t, let Y = (t s)X + s. Then Y has an extended beta distribution on (s, t). Find the density function of Y.
-
In Angels garden, there is a 3% chance that a tomato will be bad. Angel harvests 100 tomatoes and wants to know the probability that at most five tomatoes are bad. (i) The random experiment. (ii)...
-
Assume Knowlton Holdings Ltd. completed these long-term non-strategic investment transactions during 2020 : 1. Journalize Knowlton's investment transactions assuming the company reports any changes...
-
Suppose on February 1, 2020, General Motors paid \(\$ 41\) million for a \(40 \%\) investment in ABC Ltd., an auto parts manufacturer. Assume \(A B C\) earned net income of \(\$ 6\) million and paid...
-
Return to exercise SB-7, the Prudential Bache (PB) investment in CitiCorp bonds. Journalize the following on PB's books: a. Purchase of the bond investment on January 2, 2020. PB expects to hold the...
Study smarter with the SolutionInn App