Question: Hello Please help me with Game of life code for java in very basic way. Those three are the patterns of the games. Rules of
Hello Please help me with Game of life code for java in very basic way. Those three are the patterns of the games. Rules of the game
Birth : A dead cell with exactly three live neighbors becomes a live cell
Survival: A live cell with two or three neighbors stays alive
Overcrowding/Loneliness In all other cases a cell dies or remains dead
Birth : A dead cell with exactly three live neighbors becomes a live cell
Survival: A live cell with two or three neighbors stays alive
Overcrowding/Loneliness In all other cases a cell dies or remains dead
I need to figure out getNeighbours, edge. user needs to ask for pattern, # of generation, sleep time. I need it ASAP. Thank you!
import java.util.Scanner;
import java.util.Random;
public class Life
{ private char[][] world;
private char[][] glider = { {' ','*',' '}, {' ','*','*'}, {'*',' ','*'}};
private char[][] patternB = { {'*','*',' '}, {'*',' ','*'}, {' ','*','*'}};
private char[][] patternC = { {' ',' ',' '}, {' ','*','*'}, {' ','*','*'}};
week11 lifePrep 1) (3) Protected View - Saved to this PC Dipshana Shrestha -O File Home Insert Draw Design Transitions Animations Slide Show Review View Help ? Tell me what you want to do Share PROTECTED VIEW Be carefu-files from the Internet can contain viruses. Unless you need to edit, it's safer to stay in Protected View. Enable Editing Game of Life Code Walkthrough (1) 12 Ul input capability Size of board Make it square! 13 o Number of generations Typical 100 Pattern Glider, Spaceship, Tumbler etc 14 o Time between iterations - Typical 500 ms Thread.sleep (500) Board decorations 15 16 Slide 12 of 21 +77% O Type here to search e g 3:00 PM ^ @ ?? ? 5/1/2018 week11 lifePrep 1) (3) Protected View - Saved to this PC Dipshana Shrestha -O File Home Insert Draw Design Transitions Animations Slide Show Review View Help ? Tell me what you want to do Share PROTECTED VIEW Be carefu-files from the Internet can contain viruses. Unless you need to edit, it's safer to stay in Protected View. Enable Editing Game of Life Code Walkthrough (1) 12 Ul input capability Size of board Make it square! 13 o Number of generations Typical 100 Pattern Glider, Spaceship, Tumbler etc 14 o Time between iterations - Typical 500 ms Thread.sleep (500) Board decorations 15 16 Slide 12 of 21 +77% O Type here to search e g 3:00 PM ^ @ ?? ? 5/1/2018
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
