title: Java minesweeper method to add numbers around bombs not working right
body: <p>I wrote this method for my java minesweeper game, it is supposed to check spots surrounding a set of coordinates and then calculate how many bombs are near by.</p>
  
  <pre><code>public void numberMines(){
      int count = 0;
      int x = 0;
      int y = 0;
      int xMin = x-1;
      int xMax = x+1;
      int yMin = y-1;
      int yMax = y+1; 
      if (x == 0){
          xMin = 0;
      }
      if (y == 0){
          yMin = 0;   //these restrictions take care of the spots in the edges
      }
      if (x == rows){
          xMax = rows;
      }
      if (y == columns){
          yMax = columns;
      }
      //first 2 loops go through every spot on the board
      for (x=0; x&lt;rows; x++){
          for (y=0; y&lt;columns; y++){
              //if the spot selected is not a bomb, for loops check spaces surrounding it
              if (mineBoard[x][y] != bomb){
                  for (int i = xMin; i &lt;=xMax; i++){
                      for (int j = yMin; j &lt;=yMax; j++){
                          if (mineBoard[i][j] == bomb){
                              count++;
                          }
                      }
                  }
              }
  
              if (count &gt; 0){       //converts them characters
                  mineBoard[x][y] = (char)(count + '0');
                  count = 0;
              }
           }
      }
  }
  </code></pre>
  
  <p>Every time I run this method it returns 3,2,1, or empty so it does count how many bombs are around, but for some reason it is over looping and returning the same thing for every spot that is not a bomb after the first one. I really cant see where I messed up, please help!</p>