Question
IN PYTHON, We will implement the Game of Life (https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life) in this assignment. The game is played on a square grid which we will model
IN PYTHON,
We will implement the Game of Life (https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life) in this assignment. The game is played on a square grid which we will model as a list of lists. Each internal list is a collection of single characters where '.' is an empty cell in the grid, and "*' is a living organism in a cell.
The person playing the game initializes an initial configuration called generation 1. The program computes and prints all subsequent generations based on the following rules:
Any live cell with fewer than two live neighbors dies, as if by under population.
Any live cell with two or three live neighbors lives on to the next generation.
Any live cell with more than three live neighbors dies, as if by overpopulation.
Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction
The goal of this assignment is to complete the code that is supplied for implementing the game of life. The program should prompt the user for the number of generations that should be printed. The program reads a file called glider1.txt which contains the data for generation 1.
You will need to do the following:
1) Complete and test the count function which is passed a board, a row number and a column number of a cell, and returns the number of living cells that surround the given cell.
2) Implement the rules of the game in the computeNextGen function.
3) Write the code for the copyBackGen methond that is passed the current generation board and the next generation board, and copies the next generation board into the current generation board.
4) Modify the mainline code to prompt the user for the number of generations and print each generation.
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