title: Fill grid with squares which are all connected by free space
body: <p>I have a grid with x fields. This grid should be filled with as much sqaures (lets call them "farms") of the size 2x2 (so each farm is 4 fields in size) as possible. Each farm has to be connected to a certain field ("root") through "roads".</p>
  
  <p>I have written a kind of brute force algorithm which tries every combination of farms and roads. Everytime a farm is placed on the grid, the algorithm checks, if the Farm has a connection to the root using the A* algorithm. It works very well on small grids, but on large  grids, it's too time consuming.</p>
  
  <p>Here is a small already solved grid </p>
  
  <p><a href="http://www.tmk-stgeorgen.at/algo/small.png">http://www.tmk-stgeorgen.at/algo/small.png</a></p>
  
  <p>Blue squares are the farms, red squares are free space or "roads" and the filled red square is the root field, to which every farm needs a connection.</p>
  
  <p>I need to solve this grid: </p>
  
  <p><a href="http://www.tmk-stgeorgen.at/algo/grid.png">http://www.tmk-stgeorgen.at/algo/grid.png</a></p>
  
  <p>Is there any fast standard algorithm, which I can use?</p>