title: Flood-Fill ending too soon, not coming back to starting position
body: <p>I am working on a minesweeper like game and am stuck on revealing the squares that are empty. Currently I have 2 separate arrays, one that holds the game board that the player can see after each selection, and one holding the location of bombs and the tile numbers.</p>
  
  <pre><code>    playerView Array * * * * *    dataView Array *1000
                       * * * * *                   22000
                       * * * * *    the no spaces  *1011
                       * * * * *    is important   1101*
                       * * * * *                   00011
  </code></pre>
  
  <p>I did this because at the end of each game we need to show the full board or the dataView Array.</p>
  
  <p>When doing the flood fill I first check for any out-of-bounds checks, then see if the selected tile has a "0" in it and see if we have already passed over the tile. This method was passed coordinates that already passed a bomb check so I don't have to worry about that. If the tile contains a "0" I set playerView array at the passed coordinates to "0 " then pass adjacent coordinates through flood fill. If the selected tile does not contain a "0" in dataView then I set playerView to the value in dataView and return.</p>
  
  <p>I can't wrap my head around what I am missing. I have looked at similar problems here, even implemented the code line by line into mine, making tweaks as needed. I cannot get this to fill. Currently my code will fill down a column until it hits a number other than "0", it sets that number correctly, then asks me to select the next coordinate. </p>
  
  <p>As I said above I have tried to implement some of the other solutions I have found on here and youtube but haven't had any luck. I started out with a nested for loop to loop me over each adjacent cell and run the flood fill function but it was too hard to track and I couldn't debug it at all. I broke it down into what I have below.</p>
  
  <pre><code>    public void clearTiles(int row, int col) {
  
      if (row &lt; 1 || col &lt; 1) {
          return;
      }
      if (row &gt; 10 || col &gt; 10) {
          return;
      }
      if ("0".equals(Grid.dataView[row - 1][col - 1]) &amp;&amp; !"0 
          ".equals(Grid.playerView[row - 1][col - 1])) {
              Grid.playerView[row - 1][col - 1] = "0 ";
              check2 = Grid.playerView[row - 1][col - 1];
  
  
              clearTiles((row + 1), col);
              clearTiles((row - 1), col);
              clearTiles(row, (col + 1));            
              clearTiles(row, (col - 1));
      } else if (!"0 ".equals(Grid.playerView[row - 1][col - 1]) || !"0".equals(Grid.dataView[row - 1][col - 1])){
          Grid.playerView[row - 1][col - 1] = Grid.dataView[row - 1][col - 1];
          return;
      }
  
      sweepLoop();
  }
  </code></pre>
  
  <p>Taking the example posted above. I would get this.</p>
  
  <pre><code>  passing row 1, column 3        passing row 1, column 4
  playerView Array * * 0 * *         * * * 0 *
                   * * 0 * *         * * * 0 *
                   * * 0 * *         * * * 1 *
                   * * 0 * *         * * * * *
                   * * 0 * *         * * * * *
  </code></pre>
  
  <p>Expected Result:</p>
  
  <pre><code>  passing row 1, column 3
  playerView Array * 1 0 0 0
                   * 2 0 0 0
                   * 1 0 1 1
                   1 1 0 1 *
                   0 0 0 1 1
  </code></pre>