In the "Game of Life", there is a grid with some cells which may be alive or dead initially. Your task is to generate th

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

In the "Game of Life", there is a grid with some cells which may be alive or dead initially. Your task is to generate th

Post by answerhappygod »

In The Game Of Life There Is A Grid With Some Cells Which May Be Alive Or Dead Initially Your Task Is To Generate Th 1
In The Game Of Life There Is A Grid With Some Cells Which May Be Alive Or Dead Initially Your Task Is To Generate Th 1 (39.03 KiB) Viewed 42 times
In the "Game of Life", there is a grid with some cells which may be alive or dead initially. Your task is to generate the next generation of cells based on the following rules: 1. Any live cell with fewer than two live neighbors dies as if caused by underpopulation. 2. Any live cell with two or three live neighbors lives on to the next generation. 3. Any live cell with more than three live neighbors dies, as if by overpopulation. 4. Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction In this question, locations beyond a 100 x 100 board should be treated as permanently dead. a.) Show how to set up a simple 2-dimensional array of boolean values to represent a Life Board in the class Gameoflife. write an initialize_board method to initialize this array randomly.[10p] b.) write a display board method which displays the board on the screen. You can use" for the dead cells and "" for live cells. [10p] c.) For a location (ij) on the board, write a method that will decide whether the next state of that cell should be alive or dead. Make it clear how your code copes if the cell is at the boundary of the board. [30p] d.) Referring to part, write code that takes one board representing the current state of the game and fills in a second board with the state arrived at after one time step[30 pl c.) Can you modify your solution to part (e) so that you can perform a time step using just one board. How? Provide code fragments.[20p]
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply