Answered step by step
Verified Expert Solution
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...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