Guest User

Untitled

a guest
Oct 20th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. int gridSize = 0;
  2. try (Scanner scanner = new Scanner(System.in)) {
  3. System.out.println("how much the size of the grid do you want");
  4. while (!scanner.hasNextInt()) {
  5. System.err.println("Try again, this time with a proper int");
  6. scanner.next();
  7. }
  8. gridSize = scanner.nextInt();
  9. }
  10. MinesWeeper grid = new MinesWeeper(gridSize);
  11. grid.printOut();
  12.  
  13. int choice = 0;
  14. try (Scanner scanner = new Scanner(System.in)) {
  15. System.out.println("1-to step over a celln2-to set a flag on the cell");
  16. while (!scanner.hasNextInt()) {
  17. System.err.println("Try again, this time with a proper int");
  18. scanner.next();
  19. }
  20. choice = scanner.nextInt();
  21. }
  22.  
  23. boolean Continue = true;
  24. while (Continue) {
  25. switch (choice) {
  26. case 1:
  27. if (grid.chooseCell(1)) {
  28. Continue = false;
  29. }
  30. break;
  31. case 2:
  32. grid.chooseCell(2);
  33. break;
  34. }
  35. }
Add Comment
Please, Sign In to add comment