Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The game of life, invented by J. Conway, is intended to model life in a society

ID: 3543644 • Letter: T

Question


The game of life, invented by J. Conway, is intended to model life in a society of organisms. Consider a rectangular array of cells, each of which may contain an organism. If the array is viewed as extending indefinitely in both directions, then each cell has eight neighbors, the eight cells surrounding it. In each generation, births and deaths occur according to the following rules:










Write a program to play the game of life and investigate the patterns produced by various initial configurations. Some configurations die off rather rapidly; others repeat after a certain number of generations; other change shape and size and may move across the array; and others may produce gliders that detach themselves from the society and sail off into space!





Max dimensions of the array


Initial layout of the organisms


#of generations to be generated





The shape of the organisms in each generation.


The shape of the organisms at the end.

Input File (in.txt)

The format of the input file is as follows: First line is the dimensions of the grid. The next line is the number of needed generations. Then the grid containing 1s for the creatures and 0s for the spaces. The file terminates by 0 0.

5 5

1

0 0 0 0 0

0 1 1 1 0

0 0 0 0 0

0 0 0 0 0

0 0 0 0 0

5 5

2

0 0 0 0 0

0 1 1 1 0

0 0 0 0 0

0 0 0 0 0

0 0 0 0 0

0 0

Output File (out.txt)

The output file shows the final outcome of applying the rules on the grid.  At the same time, the steps should appear on the screen for the user.

Creature #1

0 0 1 0 0

0 0 1 0 0

0 0 1 0 0

0 0 0 0 0

0 0 0 0 0

Creature #2

0 0 0 0 0

0 1 1 1 0

0 0 0 0 0

0 0 0 0 0

0 0 0 0 0






Explanation / Answer


Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote