Java minesweeper game I want to hide the broad when I start the game? <p>I'm new to this site, however, I'm having problem hiding my broad when I start the game, I just want to make it invisible from the user. But I don't know where did I missed up with my code. Please help me out with this.</p> <pre><code>import java.util.Scanner; public class MineSweeperGame { int row, col; boolean succes = false; public static void main(String[] args) { MineSweeperGame ms = new MineSweeperGame(); ms.run(); } // // Recursive reveal method // public void reveal(int x, int y, char[][] mineField, boolean[][] isVisible) { int minx, miny, maxx, maxy; int result = 0; // // if cell(x, y) is not mine, make sure visible that cell. // if (mineField[x][y] != '*') { isVisible[x][y] = true; // // if cell(x, y) is blank, check all surrounding cells // if (mineField[x][y] == '.') { // // Don't try to check beyond the edges of the board... // minx = (x &lt;= 0 ? 0 : x - 1); miny = (y &lt;= 0 ? 0 : y - 1); maxx = (x &gt;= row - 1 ? row - 1 : x + 1); maxy = (y &gt;= col - 1 ? col - 1 : y + 1); // // Loop over all surrounding cells, call recursive reveal(i, j) method // for (int i = minx; i &lt;= maxx; i++) { for (int j = miny; j &lt;= maxy; j++) { if (isVisible[i][j] == false) { reveal(i, j, mineField, isVisible); } } } } } // // if cell(x, y) is mine, do nothing. // else { } } void printMineMap(char[][] mineField, boolean[][] isVisible) { System.out.println(); succes = true; // // Loop over all cells, print cells // for (int x = 0; x &lt; row; x++) { for (int y = 0; y &lt; col; y++) { // // Loop over all cells, print cells // if (isVisible[x][y]) { System.out.print(" " + mineField[x][y] + " "); } else { System.out.print("[" + mineField[x][y] + "] "); if (mineField[x][y] != '*') { succes = false; } } } System.out.println(); } if (succes) { System.out.println("********** Congratulations~!!! You win. **********"); } } private void run() { // // Initialize MineField // char[][] mineField = MineField.getMineField(); row = mineField.length; col = mineField[0].length; boolean[][] isVisible = new boolean[row][col]; // print mine map printMineMap(mineField, isVisible); while (true) { System.out.print("Enter your guess (x y): "); Scanner in = new Scanner(System.in); // // input x, y // int x = in.nextInt() - 1; if (x &lt; 0) {// if negative value, exit program. System.out.println("Canceled by user."); break; } int y = in.nextInt() - 1; if (x &gt;= row || y &gt;= col) // ignore invalid values { continue; } // // Check cell(x,y) is mine, if yes, quit program // if (mineField[x][y] == '*') { isVisible[x][y] = true; printMineMap(mineField, isVisible); System.out.println("Game Over ~!!!"); break; } // // call recursive reveal method to reveal cell(x, y) // reveal(x, y, mineField, isVisible); printMineMap(mineField, isVisible); } } } </code></pre> <p>where and example of the game when it start ( I tried to post it as the game dose but every time I try it missed up the order).</p> <pre><code>[.] [.] [1] [1] [2] [*] [1] [.] [.] [.] [1] [*] [2] [1] [1] [.] [.] [.] [1] [1] [1] [1] [2] [2] [.] [1] [2] [2] [1] [1] [*] [*] [.] [1] [*] [*] [1] [1] [2] [2] [1] [2] [3] [4] [3] [1] [.] [.] [*] [1] [1] [*] [*] [1] [.] [.] [1] [1] [1] [2] [2] [1] [.] [.] </code></pre> <p>Enter your guess (x y): </p> <p>What I want is something like this </p> <pre><code>[] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] </code></pre>