Lets say I have a grid G.
The grids cells are composed of one of two types - free or occupied.
Now given a point in the grid P, what's the biggest rectangle we can make that includes P?
That's the algorithm I'm currently writing. I wrote some on Friday, I think, but it was godawful and very complicated. The one I'm writing now is much cleaner and should work nicely.