Need advice on 2D Minesweeper text based program
<p>I could use some help with my program. I got my 1 dimensional program to work just fine so  I figured I just need I few tweaks to get the 2D to work as well. Its not fully completed but it would help to know if I am on the right track or completely off base with where I am at. If you notice any errors I could sure use the help.</p>

<pre><code>  import java.util.Scanner;

  import java.util.Random;


  public class MS2D 
  {
  public static int[][] map = new int[10][10];     
  public static boolean[][] played = new boolean[10][10]; 
  public static int row_pick;                 
  public static int col_pick;           
  public static int threshold = 6;          

  public static void main(String[] args) 
  {
     int r, c;                               // each 'row' &amp; 'column' in 2-D array
     Scanner kb = new Scanner(System.in);    // keyboard input
     boolean hit, done;

     InitMap();          // get the map randomized
     ShowMap();          // show current map (all hidden)

     while( true ) // play loop starts
     {
        System.out.print("Which row and column to play? ( -1 to quit) ");
        row_pick = kb.nextInt();
        col_pick = kb.nextInt();
        if ((col_pick &lt; 0) || (col_pick &gt; map.length - 1) || (row_pick &lt; 0) || (row_pick &gt; map.length - 1) )
        {
           System.out.println("Thanks for playing!");
           System.exit(0);
        }
        else 
        {
           if (played[row_pick][col_pick])
           {
              System.out.println("That position has been played!");
              continue;
           }    


        }   
        hit = false;
        done = false;
        if (map[row_pick][col_pick] == 9)
        {
           hit = true;
        }
        else
        {
           MarkPlayed(row_pick, col_pick);
           done = true;

           for (r = 0; r &lt;= played.length - 1; r++) 
           {
              for (c = 0; c &lt;=played.length - 1; c++)
              { 
                 if( played[r][c] == false)
                    done = false;
              }
           }    
        }
        if (hit || done)
        {
           for(r = 0; r &lt;= played.length - 1; r++)
           {
              for(c = 0; c &lt;= played.length - 1; c++)
              {
                 played[r][c] = true;
              }
           }
        }

        ShowMap();

        if (hit == true)
        {
           System.out.println("Boom! Bye, bye.");
           break;
        }   
        else if (done == true)
        {   
           System.out.println("Good Game!");
           break;      
        }  
     }
  }     


  public static int CountMines( int r, int c ) 
  {
     int count = 0; 
     if (c - 1 &gt;= 0 &amp;&amp; c - 1 == 9)
     {
        count++;
     }
     if (map[c + 1] == 9)
     {
        count++;
     }
     return count;

  } // end CountMines()


  public static void InitMap () 
  { // randomize map
     int r, c, num;
     Random rand_obj= new Random();
     for (r = 0; r &lt; map.length - 1; r++)
     {
        for (c = 0; c &lt; map.length - 1; c++)
        {  
           num = rand_obj.nextInt(10);

           if (num &gt; threshold)
           {
              map[r][c] = 9;
           }
           else
           {
              map[r][c] = 0;
           }
        }
     }
     for (r = 0; r &lt; map.length - 1; r++)
     {
        for(c = 0; c &lt; map.length - 1; c++)
        {
           if (map[r][c] == 0)
              CountMines( r, c);
        }
     }
  } // end InitMap()


  public static void MarkPlayed(int r, int c ) 
  {
     played[r][c] = true;

     if (r - 1 &gt;= 0 &amp;&amp; r - 1 != 9)
     {
        if(c - 1 &gt;= 0 &amp;&amp; c - 1 != 9)
        {
           played[r][c] = true;
        }
        if (r + 1 &gt;= 0 &amp;&amp; r + 1 != 9)
        {
           if(c + 1 &gt;= 0 &amp;&amp; c + 1 != 9)
           {
              played[r][c] = true; 
           }
        }
     }      
  } // end MarkPlayed()

  public static void ShowMap() 
  {
     int r, c;

     for ( r = 0; r &lt; played.length; r++ )
     {
        for ( c = 0; c &lt; played.length; c++ )
        {
           if ( played[r][c] ) 
           {
              System.out.print( map[r][c] + " " );
           }    
           else 
           {
              System.out.print(". "); 
           }
        }
     }
     System.out.println();

     for ( c = 0; c &lt; played.length; c++ )
     {  
        System.out.print(c + " ");
     }  
     System.out.println();

  } // end ShowMap ()

} // end class
</code></pre>
