Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int gridSize = 0;
- try (Scanner scanner = new Scanner(System.in)) {
- System.out.println("how much the size of the grid do you want");
- while (!scanner.hasNextInt()) {
- System.err.println("Try again, this time with a proper int");
- scanner.next();
- }
- gridSize = scanner.nextInt();
- }
- MinesWeeper grid = new MinesWeeper(gridSize);
- grid.printOut();
- int choice = 0;
- try (Scanner scanner = new Scanner(System.in)) {
- System.out.println("1-to step over a celln2-to set a flag on the cell");
- while (!scanner.hasNextInt()) {
- System.err.println("Try again, this time with a proper int");
- scanner.next();
- }
- choice = scanner.nextInt();
- }
- boolean Continue = true;
- while (Continue) {
- switch (choice) {
- case 1:
- if (grid.chooseCell(1)) {
- Continue = false;
- }
- break;
- case 2:
- grid.chooseCell(2);
- break;
- }
- }
Add Comment
Please, Sign In to add comment