Original Post
Im currently working on a "bust a move" style game, but have no idea how to solve the collapsing elements problem.
The gamefield is represented as a simple 2D array, and no color matching rule right now (like in the mentioned game).
The main question, how can i check if a cell (or a groups of cells) is separated from the others?
I made a picture:

Here, i marked the separated cell group that i need to remove.
Is there any general algorithm that can solve this problem?
The gamefield is represented as a simple 2D array, and no color matching rule right now (like in the mentioned game).
The main question, how can i check if a cell (or a groups of cells) is separated from the others?
I made a picture:

Here, i marked the separated cell group that i need to remove.
Is there any general algorithm that can solve this problem?