Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Game of Life, invented by the mathematician John H. Conway, is intended to model life in a society of organisms. Consider a rectangular array

image text in transcribedimage text in transcribed

The Game of Life, invented by the mathematician John H. 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: *An organism is born in any empty cell having exactly three neighbors. *An organism dies from isolation if it has fewer than two neighbors. *An organism dies from overcrowding if it has more than three neighbors. * All other organisms survive. To illustrate, the following shows the first five generations of a particular configuration of Specific Instructions Write a modular program to simulate 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; others change shape and size and may move across the array; and still others may produce 'gliders' that detach themselves from the society and sail off into space! Since the game requires an array of cells that continually expands/shrinks, you would want to use multi-dimensional arrays and dynamic memory allocation. Your program should consist of at least two modules. One module will implement a class to represent Game of Life. Following good object-oriented programming practices, keep the data members private. Accessor functions should be declared to set and get the private data if needed. A Game of Life object should be able to initialize itself using input from a file, evolve through the different generations and display each generation! Write a test program that illustrates the use of your Game of life class and representative output (at least 5 generations) for every dataset in the input file that will be provided. Additionally, the output should be displayed in format that is easy to understand and you have to make use of at least one of the functionalities from the header file Overloading of input and output operators is required. Include all the source code (well documented) and input/output files/screenshots Please note that the object creation should not be inside the big loop of the main program. Sample Input file: 4 5 Vindicates number of rows and columns 1 1 Vlist of all the positions of organisms 12 1 3 //end of current dataset, there can be more datasets in a larger input file Corresponding Output file: #xxx# ##x## Generation 2: ##x## #xxx# #xxx# Generation 3 #xxx# ##x## Generation 4: ##x## ##x## ##x## ##x## #xxx# The Game of Life, invented by the mathematician John H. 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: *An organism is born in any empty cell having exactly three neighbors. *An organism dies from isolation if it has fewer than two neighbors. *An organism dies from overcrowding if it has more than three neighbors. * All other organisms survive. To illustrate, the following shows the first five generations of a particular configuration of Specific Instructions Write a modular program to simulate 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; others change shape and size and may move across the array; and still others may produce 'gliders' that detach themselves from the society and sail off into space! Since the game requires an array of cells that continually expands/shrinks, you would want to use multi-dimensional arrays and dynamic memory allocation. Your program should consist of at least two modules. One module will implement a class to represent Game of Life. Following good object-oriented programming practices, keep the data members private. Accessor functions should be declared to set and get the private data if needed. A Game of Life object should be able to initialize itself using input from a file, evolve through the different generations and display each generation! Write a test program that illustrates the use of your Game of life class and representative output (at least 5 generations) for every dataset in the input file that will be provided. Additionally, the output should be displayed in format that is easy to understand and you have to make use of at least one of the functionalities from the header file Overloading of input and output operators is required. Include all the source code (well documented) and input/output files/screenshots Please note that the object creation should not be inside the big loop of the main program. Sample Input file: 4 5 Vindicates number of rows and columns 1 1 Vlist of all the positions of organisms 12 1 3 //end of current dataset, there can be more datasets in a larger input file Corresponding Output file: #xxx# ##x## Generation 2: ##x## #xxx# #xxx# Generation 3 #xxx# ##x## Generation 4: ##x## ##x## ##x## ##x## #xxx#

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 10g Database Administrator Implementation And Administration

Authors: Gavin Powell, Carol McCullough Dieter

2nd Edition

1418836656, 9781418836658

Students also viewed these Databases questions