import java.util.*; public class Array { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner reader = new Scanner(System.in); Random Generator = new Random(); // Grid creation int[][] Minesweeper = new int[11][11]; char[][] MinesweeperCheck = new char[11][11]; int iCount1 = 0; int iCount2 = 0; int iCount3 = 0; for(iCount1 = 1; iCount1 < 11; iCount1++){ for(iCount2 = 1; iCount2 < 11; iCount2++){ Minesweeper[iCount1][iCount2]=Generator.nextInt(4); } } // Input for(iCount3 = 0; iCount3 < 100; iCount3++){ int inputx = 1; int inputy = 1; System.out.println("Enter X value (1-10):"); inputx = reader.nextInt(); System.out.println("Enter Y value (1-10):"); inputy = reader.nextInt(); MinesweeperCheck[inputx][inputy] = '*'; if((Minesweeper[inputx][inputy] == 0) || (Minesweeper[inputx][inputy] == 1) || (Minesweeper[inputx][inputy] == 2)){ System.out.println("You are safe."); for(iCount2 = 1; iCount2 < 11; iCount2++){ for(iCount1 = 1; iCount1 < 11; iCount1++){ System.out.print(MinesweeperCheck[iCount1][iCount2]); } System.out.println(); } for(iCount2 = 1; iCount2 < 11; iCount2++){ for(iCount1 = 1; iCount1 < 11; iCount1++){ System.out.print(Minesweeper[iCount1][iCount2]); } System.out.println(); } } if(Minesweeper[inputx][inputy] == 3){ System.out.println("You hit a bomb! You are dead."); return; } } } }