Question: solve this problem using matlab software , Game of Life. In this problem, we will be simulating the fate of living cells using the rules

solve this problem using matlab software , Game of Life.
In this problem, we will be simulating the fate of living cells using the rules from mathematician John Conway's famous "'Game of Life". Cells exist at each point on a 2D grid and can be in one of two states: alive (1) or dead (0), as shown in the figure below.
Initial Condition
After 1 Update
In calculating the next generation, an individual cell's survival depends on the state of its 8 nearest neighbors (vertically, horizontally, and diagonally adjacent cells). Your code should enforce the following classical rules to calculate each successive generation:
- A living cell with either 2 or 3 living neighbors survives on to the next generation.
- A living cell with fewer than 2 or more than 3 living neighbors does not survive on to the next generation due to isolation or overcrowding, respectively.
- A dead cell with exactly 3 live neighbors becomes a living cell in the next generation.
You must employ periodic boundary conditions in this problem to allow the grid to "wrap around" onto itself in both the \( x \) and \( y \)-direction to avoid artificially influencing cells at the edge of the domain (in the simplified figure above, no boundary conditions were considered and non-visible cells were assumed to hold zeros). Refer to the lecture slides on how to implement these boundary conditions. To visualize the results, we will be suing the MATLAB function imagesc. To create an animation of your results, simply call imagesc for every generation and use the drawnow function to ensure that each time-step is displayed.
Demonstrate your method on a grid with \(150\times 200\). To initialize your game, randomly distribute a 2D array where each cell has probability 10\% of being alive and \(90\%\) of being dead. Run your simulation for 300 time-steps (generations). Plot the number of living cells in your simulation as a function of time.
solve this problem using matlab software , Game

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!