title: Anyone knows an algorithm for finding "shapes" in 2d arrays?
body: <p>Let's take this map, where '#' illustrates a taken square and '.' illustrates a free square:</p>
  
  <pre>
  1 . # # # . .
  2 . # . . # .
  3 # . . . . #
  4 . # # # . .
  5 . . . . . .
  6 . . . . . .
  - 1 2 3 4 5 6
  </pre>
  
  <p>Now, if I put a '#' in the square 4,5 the area would be "filled" like this:</p>
  
  <pre>
  1 . # # # . .
  2 . # # # # .
  3 # # # # # #
  4 . # # # # .
  5 . . . . . .
  6 . . . . . .
  - 1 2 3 4 5 6
  </pre>
  
  <p>So, what is the best way to find "a limited square", where I can start flood fill or other filling algorithm that fills the limited area? </p>