Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Answer Here is a simple Java implementation of the Game Of Life Grid is initialized with 0s represen... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Probability With Applications and R

Authors: Robert P. Dobrow

1st edition

1118241257, 1118241258, 978-1118241257

More Books

Students also viewed these Programming questions

Question

What is master production scheduling and how is it done?

Answered: 1 week ago

Question

Let X Beta(a, b). For s Answered: 1 week ago

Answered: 1 week ago