Conway’s Game of Life In this life form, again, an organism consists of single cells that are on (alive) or off (dead). The organisms exist in a two-dimensional grid world, as in Figure 14.9. The...


Conway’s Game of Life In this life form, again, an organism consists of single cells that are on (alive) or off (dead). The organisms exist in a two-dimensional grid world, as in Figure 14.9.


The rules governing this organism are:


1. If a live cell has two or three neighbours, it will survive. Otherwise it will die of isolation or overcrowding.


2. If an empty cell is surrounded by exactly three cells, then a new live cell will be born to fill the space.


3. All births and deaths take place simultaneously.


Write a program to simulate this kind of life. The program should initially allow the user to click on the cells that are to be alive. Provide a button that allows the user to go on to the next generation and display it.


The program needs two arrays – one to represent the current state of life and another to represent the next generation. After each new generation is created, the roles of the two arrays are swapped.




May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here