Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Shavit Borisov
- // CW
- import java.util.Scanner;
- public class MineBoardGame {
- public static void main(String[] args)
- {
- Scanner in = new Scanner (System.in);
- final int BOARD_SIZE = 10;
- boolean[] board = new boolean[BOARD_SIZE];
- int pawn;
- System.out.println("Enter the board details: Type F for a cell with a mine, and T for a free cell: ");
- for(int i = 0; i < BOARD_SIZE; i++)
- {
- System.out.printf("Enter status of cell number %d: ", i + 1);
- board[i] = (in.nextLine().charAt(0) == 'T');
- }
- System.out.print("Enter the pawn position: ");
- pawn = in.nextInt() - 1;
- System.out.println("Throws that lead to empty positions: ");
- for(int i = 1; i <= 6; i++)
- if(board[pawn + i])
- System.out.printf("%d ==> Cell No. %d\n", i, pawn + i);
- in.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement