Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class GameOfLife
- {
- public static void main(String[] args)
- {
- int[][] boardList = new int[15][15];
- Scanner myScanner = new Scanner(System.in);
- boolean done = false;
- do
- {
- System.out.println("1 - Add a being \n 2 - Show current board \n 3 - Show next generation \n 4 - Clear board \n 5 - Add preload pattern \n 6 - Exit");
- int choice = Integer.parseInt(myScanner.nextLine());
- if (choice == 1)
- {
- System.out.print("Enter the x coordinate: ");
- String answer = myScanner.nextLine();
- int xCoordinate = Integer.parseInt(answer);
- System.out.print("Enter the y coordinate: ");
- String answer2 = myScanner.nextLine();
- int yCoordinate = Integer.parseInt(answer2);
- for(int i = 0; i < 15; i++)
- {
- for(int j = 0; j < 15; j++)
- {
- if(xCoordinate == i)
- {
- if(yCoordinate == j)
- {
- System.out.printf("x", boardList[i][j]);
- }
- }
- else
- System.out.printf("-", boardList[i][j]);
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement