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++ (10th Edition)
Additional Engineering Textbook Solutions
Degarmo's Materials And Processes In Manufacturing
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
SURVEY OF OPERATING SYSTEMS
Modern Database Management
INTERNATIONAL EDITION---Engineering Mechanics: Statics, 14th edition (SI unit)
- Lets say we are creating a python game. A word is displayed gets displayed on the screen. The players of the game must type as many words as they an that are related to the word that is displayed. If players type in the same word multiple times, it is ignored. One the players are done taking turns, the program gives each player a score that is based off how many wrods they entered that are similiar to what other words players have entered. So for a player to get a point, the word they typed must be typed by another student. QUESTION: We need to store the words typed by the players and all words etered. Would we use a list, set, dict or tuple?arrow_forwardA robot starts on a point marked “A” on a rectangular grid of points. The starting point is always the top left point on the grid. The robot can move left, right, up or down, moving from one point to the next. By moving in steps going left, right, up or down, the robot would like to reach a point marked “B”, which is always the bottom right point in the grid. Sometimes, points are marked as “x”, and the robot is not allowed to visit them at all. A robot is never allowed to visit a point more than once. In how many ways can the robot move from A to B and visit all points along the way? For example, in the following grid, represented in text as A . . . . B there is only one path from A to B: In the following grid, represented in text as A . . x x B there is still only one path (we're lucky because of the two x's): However, in the grid A . . . x B there are no ways for the robot to move from A to B and visit all points that are not marked with “x”. Write a single…arrow_forwardCreate a program that provides visualization for three-dimensional plane: Animate your solution using any animation programming language like matlab please. (so the output should show graph of the exponential function inputted by the user)the system should be user-input, and the output should show graph of the exponential function inputted by the user) The topic is all about Inverse Laplace Transform on Exponential function.arrow_forward
- Let's begin with a lesson in roulette. Roulette is a casino game that involves spinning a ball on a wheel that is marked with numbered squares that are red, black, or green. Half of the numbers 1–36 are colored red and half are black and the numbers 0 and 00 are green. Each number occurs only once on the wheel. We can make many different types of bets, but two of the most common are to bet on a single number (1–36) or to bet on a color (either red or black). These will be the two bets we will consider in this project. After all players place their bets on the table, the wheel is spun and the ball tossed onto the wheel. The pocket in which the ball lands on the wheel determines the winning number and color. The ball can land on only one color and number at a time. We begin by placing a bet on a number between 1 and 36. This bet pays 36 to 1 in most casinos, which means we will be paid $36 for each $1 we bet on the winning number. If we lose, we simply lose whatever amount of money we…arrow_forwardLet's begin with a lesson in roulette. Roulette is a casino game that involves spinning a ball on a wheel that is marked with numbered squares that are red, black, or green. Half of the numbers 1–36 are colored red and half are black and the numbers 0 and 00 are green. Each number occurs only once on the wheel. We can make many different types of bets, but two of the most common are to bet on a single number (1–36) or to bet on a color (either red or black). These will be the two bets we will consider in this project. After all players place their bets on the table, the wheel is spun and the ball tossed onto the wheel. The pocket in which the ball lands on the wheel determines the winning number and color. The ball can land on only one color and number at a time. We begin by placing a bet on a number between 1 and 36. This bet pays 36 to 1 in most casinos, which means we will be paid $36 for each $1 we bet on the winning number. If we lose, we simply lose whatever amount of money we…arrow_forwardYou are going to write a simulation for a mini survival game. 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. Use the topics (Abstract classes, Interface, etc.) to implementthe simulation. (in java) An example output is given below.arrow_forward
- In python In a hotel, there are a number of guests and cleaning staff. There is a conference room where guests can enter to have a party. Rules of using the room The guests and cleaning staff will be processes in your assignment. If someone from the cleaning staff is in the room cleaning, no guest can enter the room. Only one person from the cleaning staff can be in the room at a time. If guests are in the room, the cleaning staff will wait until the room is empty before entering. If the room is empty or other guests are in the room, guests can enter the room. You can have multiple guests in the room at the same time. The first guest to enter the empty room, will turn on the lights. The last guest to leave the room, will turn of the lights. (This is not the first guest in most cases) Guests can enter and leave the room at anytime as long as the room is empty or contains other guests. It is not uncommon for guests to enter the room, leave and then enter the room again while the party…arrow_forwardMade this program using Javaarrow_forwardA renowned software company in Bangladesh is going to develop a system for parallelogram. Now, consider yourself as a programmer of that project and develop the following class: Parallelogram -base: double -height: double + Appropriate Property(s) + Appropriate Constructor(s) + GetVolume(): double + ToString(): string (1) Method GetVolume() returns the volume(bxh) of a parallelogram object. (2) Method ToString() returns the string representation of a parallelogram object Example:parallelogram [base: 4cm; height: 2cm] PARALLELOGRAM do not need to write the main method Height Base Sub: C#arrow_forward
- Write a Python application for the following scenario. You have some students in your Introduction to Python Programming class. Write an interactive program that asks the user to input the names of each student and then their grades. Each student inputs three grades (Exam 1, 2 and 3 (you can create categories of your choice)). Calculate the total scores of each student. With the data that you have collected, please create a graph (pie chart or column charts) with the information of your students. Try to use data labels for your program. Please follow the rubric and submit everything as required. Hint: Use any of the concepts that you have learnt through the course. You can use methods, lists, or anything that you would find necessary to create the solution.arrow_forwardPlease code in JAVA and follow the instructions as it is mentioned.. please refer the images provided for scope and proper output making a retro-style game called Zeldar. You've been tasked to implement the player movement. The game is top- down, with the overworld modeled as a 2d grid. The player's location is tracked by x,y values correlating to its row and column positions within that grid. Given the current position of the player and a sequence of input commands: w,a,s,d you must determine the new position of the player.Facts● the player's position is modeled using two integer values (x, y)● x represents the column position, left-right axis● y represents the row position, up-down axis● “w” move up by decreasing y by 1● “a” move left by decreasing x by 1 ● “s” move down by increasing y by 1 ● “d” move right by increasing x by 1InputThe input will begin with a single line containing the number of test cases to execute. The next line should consist of the starting (x,y) position of…arrow_forwardI'm developing a card game that requires one deck of 52 cards using Java. The 52 card has 4 suits from top to bottom: diamonds (d), clubs (c), hearts (h), and spades (s). Each card has a point. The rest of the instructions are in the images. Based on the code below, it outputs the maximum points of all 5 sorted cards. Instead, I need the total point chosen from the suit that gives the highest point. The images shown are for reference purposes. import java.util.HashMap; import java.io.*; public class CardPointsList { static HashMap<String,Integer> Code = new HashMap<>(); static HashMap<Character,Integer> Order = new HashMap<>(); static String[][] hand= {{ "c5","s6","sK","dK","dA"},{"s7","s4","dJ","sA","h5"},{"sQ","d3","c9","hK","d5"}}; static int[] scores={0,0,0}; public static void sortHand() { String temp; for (int h=0;h<3;h++) {for (int i=0;i<5;i++) { for (int j=i+1;j<5;j++) { if (hand[h][j].charAt(0)…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