Hey guys,

I use a map building algorithm for use with A*. I expand the map outwards from a certain point manually, but I'm looking to make the process automatic. Alas I'm not quite sure how to handle when to stop.

example:



The simple case first. If I start the expansion from the green point, I'd like to know when the location is fully encompassed by a solid barrier surrounding the tile, i.e if I was to set the A* to try and return a path to outside of this area, it would return null.

Now the more difficult case. If I was to expand from the red point I'd like to do the same thing, however you'll notice that in some areas the maps have multiple interconnecting walls and so a linear search of all solid objects is not really appropriate I don't think. This case isn't particularly well illustrated, as the red location isn't actually fully surrounded by a complete wall and so I'm hoping you can imagine a more complicated situation where the red location is surrounded by a series of interconnecting walls.

Your help will be much appreciated guys