title: Flood fill algorithm maze
body: <p>I ma trying to make my program read a maze like this:</p>
  
  <pre><code>    #.#######
      #.......#
      ####.####
      #....#..#
      #.####.##
  </code></pre>
  
  <p>and print out the reachable zones and non-reachable zones in the maze, which should look like this:</p>
  
  <pre><code>    #+#######
      #+++++++#
      ####+####
      #++++#--#
      #+####-##
  </code></pre>
  
  <p>Walls are represented with "#", and passable cells are represented with ".".</p>
  
  <p>The "+" that replaces the cells means that those cells are reachable from the top entry point of the maze. The "-" symbol are the cells that can't be reached if you enter the top of the maze.</p>
  
  <p>For example, in the above maze, all the cells are reachable except for the cells in the bottom right-hand corner. This is because those cells cannot be reached from the entry point at the top of the maze. </p>
  
  <p>I am trying to use some recursion to flood fill the maze, and determine the reachable zones, but I am having trouble with that. </p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>    int
      flood_fill(m_t * maze, int row, int col) {
  
          int direction;
  
          direction = flood_fill(maze, row+1, col); /* down */
          if (!direction) {
              direction = flood_fill(maze, row, col+1); /* right */
          }
  
          if (!direction) {
              direction = flood_fill(maze, row-1, col); /* up */
          }
  
          if (!direction) {
              direction = flood_fill(maze, row, col-1); /* left */
          }
  
          if (direction) {
              maze-&gt;M[row][col].type = path;
          }
  
          return direction;
      }
  </code></pre>
  
  <p>I know that my flood_fill function is not doing the right thing, and I'm having difficulty getting it right. Can anyone help me please me get my flood filling part of the code right, so I can call the function elsewhere in the code and determine which cells can be reached. </p>