The mathematician John Horton Conway invented the “Game of Life.”
Though not a “game” in any traditional sense, it provides interesting behaviour that is specified with only a few rules. This project asks you to write a program that allows you to specify an initial configuration. The program follows the rules of LIFE to show the continuing behavior of the configuration.
LIFE is an organism that lives in a discrete, two-dimensional world. While this world is actually unlimited, we don’t have that luxury, so we restrict the array to 80 characters wide by 22 character positions high. If you have access to a larger screen, by all means use it.
This world is an array with each cell capable of holding one LIFE cell. Generations mark the passing of time. Each generation brings births and deaths to the LIFE community. The births and deaths follow the following set of rules.
- We define each cell to have eight neighbor cells. The neighbors of a cell are the cells directly above, below, to the right, to the left, diagonally above to the right and left, and diagonally below to the right and left.
- If an occupied cell has zero or one neighbors, it dies of loneliness. If an occupied cell has more than three neighbors, it dies of overcrowding.
- If an empty cell has exactly three occupied neighbor cells, there is a birth of a new cell to replace the empty cell.
- Births and deaths are instantaneous and occur at the changes of generation. A cell dying for whatever reason may help cause birth, but a newborn cell cannot resurrect a cell that is dying, nor will a cell’s death prevent the death of another, say, by reducing the local population.
Notes: Some configurations grow from relatively small starting configurations. Others move across the region. It is recommended that for text output you use a rectangular array of char with 80 columns and 22 rows to store the LIFE world’s successive generations. Use an asterisk * to indicate a living cell, and use a blank to indicate an empty (or dead) cell. If you have a screen with more rows than that, by all means make use of the whole screen.Examples:
***
becomes
*
*
*
then becomes
***
again, and so on.
Suggestions: Look for stable configurations. That is, look for communities that repeat patterns continually. The number of configurations in the repetition is called the period. There are configurations that are fixed, which continue without change. A possible project is to find such configurations.
Hints: Define a void function named generation that takes the array we call world, an 80-column by 22-row array of char, which contains the initial configuration. The function scans the array and modifies the cells, marking the cells with births and deaths in accord with the rules listed earlier. This involves examining each cell in turn, either killing the cell, letting it live, or, if the cell is empty, deciding whether a cell should be born. There should be a function display that accepts the array world and displays the array on the screen. Some sort of time delay is appropriate between calls to generation and display. To do this, your program should generate and display the next generation when you press Return. You are at liberty to automate this, but automation is not necessary for the program.
Want to see the full answer?
Check out a sample textbook solutionChapter 7 Solutions
Problem Solving with C++, Student Value Edition plus MyProgrammingLab with Pearson eText -- Access Card Package (9th Edition)
Additional Engineering Textbook Solutions
Concepts of Programming Languages (11th Edition)
Using MIS (10th Edition)
Starting Out with C++ from Control Structures to Objects (9th Edition)
Java: An Introduction to Problem Solving and Programming (8th Edition)
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
- The mathematician Conway imagined a game, called game of life, whichconsidered cells that are susceptible to reproduce, disappear, or survive when they obey certain rules. These cells are represented by elements on a grid of squares, where a grid has an arbitrary size. Thus, each cell (except those on the boundaries of the grid) is surrounded by eight squares that contain other cells. The rules are stated as follows : 1. Survival: Each cell that has two or three adjacent cells survives until the next generation. 2. Death: Each cell that has at least four adjacent cells disappears (or dies) by overpopulation.Also, each cell that has at most one adjacent cell dies by isolation. 3. Birth: Each empty square (i.e., dead cell) that is adjacent to exactly three cells gives birthto a new cell for the next generation. It is worth noting that all births and deaths occur at the same time during a generation. Write a program that simulates this game and displays all successive generations, using…arrow_forwardThe mathematician Conway imagined a game, called game of life, whichconsidered cells that are susceptible to reproduce, disappear, or survive when they obey certain rules. These cells are represented by elements on a grid of squares, where a grid has an arbitrary size. Thus, each cell (except those on the boundaries of the grid) is surrounded by eight squares that contain other cells. The rules are stated as follows : 1. Survival: Each cell that has two or three adjacent cells survives until the next generation. 2. Death: Each cell that has at least four adjacent cells disappears (or dies) by overpopulation.Also, each cell that has at most one adjacent cell dies by isolation. 3. Birth: Each empty square (i.e., dead cell) that is adjacent to exactly three cells gives birth to a new cell for the next generation. It is worth noting that all births and deaths occur at the same time during a generation. HELP TO SOLVE THIS IN 'R' PROGRAMMING / PYTHONarrow_forwardThe mathematician Conway imagined a game, called game of life, whichconsidered cells that are susceptible to reproduce, disappear, or survive when they obey certain rules. These cells are represented by elements on a grid of squares, where a grid has an arbitrary size. Thus, each cell (except those on the boundaries of the grid) is surrounded by eight squares that contain other cells. The rules are stated as follows : 1. Survival: Each cell that has two or three adjacent cells survives until the next generation. 2. Death: Each cell that has at least four adjacent cells disappears (or dies) by overpopulation.Also, each cell that has at most one adjacent cell dies by isolation. 3. Birth: Each empty square (i.e., dead cell) that is adjacent to exactly three cells gives birth to a new cell for the next generation. It is worth noting that all births and deaths occur at the same time during a generation. HELP TO SOLVE THIS IN PYTHON PROGRAMMINGarrow_forward
- Your task will be to create a simple text-based simulation that inherits from a pre-existing World class. You must use the World.h provided as a starting point for your code. At least one object in your solution should meaningfully inherit from this class. DO NOT MODIFY THE WORLD CLASS in any way. Note that the World class is abstract and there are a few pure virtual functions for you to implement in your object that inherits from the world. Namely, you will need to implement: void PrintGrid() - This function should print the grid (10 by 10 char array) to standard out. void UpdateGrid() - This function should update your characters' positions on the grid void initGrid() - This function should set your grid up (implement your "starting conditions" here) The scenarios that you will simulate will be confined to a 10x10 grid (defined in the World class as grid) and be subject to at least 10 distinct rules. In addition, there must be at least 2 different objects or “characters”…arrow_forwardYou are to write an Ant class to simulate Langton's Ant. In this simulation, a virtual "ant" moves about a two-dimensional square matrix, whose spaces can be designated white or black, according to the rules below: If the ant is on a white space, it will turn right 90 degrees relative to the directions it is facing, move forward one step, and change the space it left to black. If the ant is on a black space, it will turn left 90 degrees relative to the directions it is facing, move forward one step, and change the space it left to white. When the ant hits the edge of the board and is going to go out of the bounds, wrap the board around so the ant will appear on the other side. The matrix is initially composed of all white spaces. The user will specify the size of the square matrix. The user will also specify the number of steps that the ant will move and the starting location and direction of the ant. After the simulation, the final board with the ant position will be displayed to…arrow_forwardFor library management, this project can consider multiple departments –e.g. Computer, Electronics, and Architecture. These departments work simultaneously with the operations as the following. You can add a book to the Civil section, delete a book from the Electrical section or view issued book details of the Mechanical department. You may also search a book according to different identifications. Some sample functions are: Using Code::Block C++ without add or delete choice, only below points 1-void searchbooks(void) 2-void issuebooks(void) 3-void viewbooks(void) 4- void issuerecord() – With this function, you can keep record of the student to whom the book has been issued. 5- End of programarrow_forward
- For library management, this project can consider multiple departments –e.g. Computer, Electrical, Civil, Electronics, Mechanical and Architecture. These departments work simultaneously with the operations as the following. You can add a book to the Civil section, delete a book from the Electrical section or view issued book details of the Mechanical department. You may also search a book according to different identifications. Some sample functions are: Using Code::Block 1-void searchbooks(void) 2-void issuebooks(void) 3-void viewbooks(void) 4- void issuerecord() – With this function, you can keep record of the student to whom the book has been issued.arrow_forwardI already have the programming part done for this problem, just need help with making UML diagram. So please help create UML diagram for this problem. I am pasting my program code underneath so you can copy paste and run it, so you don't need to create a program and attatching the instruction manual in the images so you know what is expected of the UML diagram. 1. Programm code for Cylinder class: package homework; public class Cylinder { //Declare date fieldsprivate double radius, length; //Static date fieldstatic int ObjectsCreated = 0; //Constructor to create cylinder with default value of 1.0 for dimensions public Cylinder() {double radius;double length; this.radius = 1.0;this.length = 1.0; ObjectsCreated++;} //Constructor to create cylinder with specified radius and length public Cylinder(double radius, double length) { this.radius = radius;this.length = length;ObjectsCreated++;} //Functions to set values of cylinder's radius and lengthpublic double…arrow_forwardI need help with a Java program over a University class program shown in the image below: I need to know what I should type down described in the given detail here - Each university object will contain the following information.University NameStreet Address // 1934 Same StreetCity // AnnandaleState // StateZIP // 02497Phone number // 7033345343In-State Tuition per creditup to 12 credits12 – 18 creditsover 18 creditsOut of State Tuition per creditup to 12 credits12 – 18 creditsover 18 creditsLate FeesIncidental feesper credit fee to some maximum feeOptional Health Careper credit scaleup to 12 credits12 – 18 creditsover 18 creditsOn Campus Meal PlanTwo or more plans with different costs eachThe University class will implement getter and setter methods for each field variable. It will also include toString()and equals() methods.The program will store these objects and their information in two separate dynamic data structures, one for thestudents and one for the universities.…arrow_forward
- Please read the thickened sentences below In this game, one flyand three frogs are placed randomly on a board with the size 7x7.In each iteration, they move randomlywithin the board, and the simulation stops when one of the frogs eats the fly.Fly and frogs are essentially creatures that can move, make noise, and eat. Frogs can move up to 2squares in any direction, and flies can move up to 1. Frogs make the "Croak! Croak!" sound, and fliesmake "ZzzZZz!". Since frogs should not eat their kind, a function of "isEatable" should also beimplemented in decision making. A variable or function to check if the fly is alive is also required as aterminate condition for simulation.In each iteration, an 'f' character represents frogs' position on board, and an '*' character is used torepresent the position of fly. Java language please I dont want the survival game starting with the code below I want in Java language and like in photos please #functions def GenerateRandomScene(): scenes =…arrow_forwardSuppose that in a kitchen there is only one four-burner stove to be used both for frying pans and for clay pots. So that there are no problems, they were imposed some rules: - There cannot be clay pots and pans on a stove top at the same time - There cannot be more than three pans on the stove at the same time Using traffic lights, create a program that simulates the use of stovetops in a environment with N frying pans and M clay pots (N and M can be the same or different), from so that there is no starvation and/or deadlock. Print the number of pans or pans on the stove each time the value of them beupdated (every time the quantity changes) Example: The hob has 1 frying pan. The hob has 2 pans. The stove burner has 1 pan. The hob has 2 pans. main class includearrow_forwardComputer Science Practice Task : Write a program in phyton language . Implement Water Jug Problem using DFS in Python, initial stage (0,0) and final stage (2,Y). A Water Jug Problem: You are given two jugs, a 4-gallon one and a 3- gallon one, a pump which has unlimited water which you can use to fill the jug, and the ground on which water may be poured. Neither jug has any measuring markings on it. How can you get exactly 2 gallons of water in the 4-gallon jug?arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education