PDA

View Full Version : Determining an enclosed map area.



Jymamon
02-05-2012, 06:27 AM
Given a starting room and a set of boundary rooms, how can I generate a list of all rooms enclosed by the boundaries?

Obviously, I could just use brute force and end up with a list of all rooms that I can't get to from the start room without having to cross one of the boundaries, but that can't be fast or cheap to do.

For my purposes, we can assume the list of boundary rooms does effectively close off an area (which may consist of just the boundary rooms).

This sounds like an ideal problem for graph theory. Unfortunately, that wasn't one of my strong classes and it's been a long time since I've dealt with it. Before I completely dust off those brain cells, I wanted to see if anyone already had (or could think of) a good solution to the problem.