Having a list of rooms with theirs connection to each other, how do I find isolated room groups?

Posted by petervaz on Game Development See other posts from Game Development or by petervaz
Published on 2012-10-17T20:59:24Z Indexed on 2012/10/17 23:21 UTC
Read the original article Hit count: 156

Filed under:
|

I'm trying to create a small roguelike and went as far as random generating rooms and corridors. Each room is an instanced object and contain an arraylist of the others rooms connected by a corridor.

I can single out unconnected rooms but how can I know the rooms that are connected only to each other but not to most of the others, forming an island?

to illustrated better the problem here is an image from the console on a bogged level. Rooms 5 and 6 are connected only to each other. What algorithm can I use to detect that?

enter image description here

© Game Development or respective owner

Related posts about java

Related posts about algorithm