Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Solve using Matlab: Option 2: Conway's Game of Life Your task is to write a program that plays Conway's Game of Life (for details and
Solve using Matlab:
Option 2: Conway's Game of Life Your task is to write a program that plays Conway's Game of Life (for details and ex amples, see https://en.wikipedia.org/wiki/Conway's Game of Life). The basic game is played on a 2-dimensional grid of square cells, each of which is either alive or dead. With each generation, each cell changes according to the following instructions 1. Any dead cell with exactly three live neighbors (out of its eight nearest neighbors) comes to life [reproduction] 2. Any live cell with fewer than two live neighbors dies underpopulation] 3. Any live cell with more than three live neighbors dies [overpopulation] 4. Any live cell with two or three neighbors continues to live The output of the game is therefore entirely determined by its initial state, which you may represent in terms of a matrix whose entries are all 0/1 The details of the program are up to you (whatever makes for an interesting result), but consider the following choices 1. You will probably want to keep track of two matrices: one (e.g. thisGen) with the information for the current generation, and one (e.g. nextGen) where you definen formation for the next generation. Then swap them with thisGen = nextGen; and repeat 2. The grid may be infinite (where your matrix has to get larger over time), finite with a boundary, or toroidal (if an object moves off the right side of the screen, it reappears on the left side) 3. Include some functions that allow the user to progress g generations with frame rate r, then stop and await further instructions. (This as an alternative to running the program a fixed number of generations before quitting, or to running indefinitely) Option 2: Conway's Game of Life Your task is to write a program that plays Conway's Game of Life (for details and ex amples, see https://en.wikipedia.org/wiki/Conway's Game of Life). The basic game is played on a 2-dimensional grid of square cells, each of which is either alive or dead. With each generation, each cell changes according to the following instructions 1. Any dead cell with exactly three live neighbors (out of its eight nearest neighbors) comes to life [reproduction] 2. Any live cell with fewer than two live neighbors dies underpopulation] 3. Any live cell with more than three live neighbors dies [overpopulation] 4. Any live cell with two or three neighbors continues to live The output of the game is therefore entirely determined by its initial state, which you may represent in terms of a matrix whose entries are all 0/1 The details of the program are up to you (whatever makes for an interesting result), but consider the following choices 1. You will probably want to keep track of two matrices: one (e.g. thisGen) with the information for the current generation, and one (e.g. nextGen) where you definen formation for the next generation. Then swap them with thisGen = nextGen; and repeat 2. The grid may be infinite (where your matrix has to get larger over time), finite with a boundary, or toroidal (if an object moves off the right side of the screen, it reappears on the left side) 3. Include some functions that allow the user to progress g generations with frame rate r, then stop and await further instructions. (This as an alternative to running the program a fixed number of generations before quitting, or to running indefinitely)Step 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