1. ## determine if adversary pawns are captivated

Hey everyone. I am trying to write a simple application that resembles the game "Computer Co", but I am stuck with this problem: If the board is represented by a dimensional array, with what algorithm could I tell if one player's pieces are captivated by the other's? In other words, how can I recognise whether the pieces of one colour form a circle?
Sorry for my English.

2. Go to my website, and go to the binary image processing section.
There's a fucntion called floodfill which will do what you want. You represent the opposing pieces as set bits, then floodfill. If no two opposite edges have floodfiled pixels, you point of interest is surrounded.

3. Originally Posted by Malcolm McLean
Go to my website, and go to the binary image processing section.
There's a fucntion called floodfill which will do what you want. You represent the opposing pieces as set bits, then floodfill. If no two opposite edges have floodfiled pixels, you point of interest is surrounded.
Are you sure? I could not find any function called "floodfill". Can you link me please? As I understand, this kind of code concerns graphics. Is it certain that it can also apply to my problem?

4. I'm not familiar with "Computer Co". Use [code]
Code:
``` tags around a text display of the board, and men
(so the spacing stays in place on the forum).```
You show the problem, and I'll show you the answer.

Such a deal.

5. Originally Posted by vril
As I understand, this kind of code concerns graphics. Is it certain that it can also apply to my problem?
Look at Flood fill on Wikipedia to see if that algorithm helps you.

Bye, Andreas

6. You, guys, are awesome! At first, I couldn't figure out how the floodfill algorithm can answer my decision problem (whether there is a connected area on my board), but I came up with an idea: I could use the algo to fill both the opposite colour and blanks with a target colour and then check the whole board. In case there is no piece of the opposite colour left, then there was a "leak", so no captivation. Right? In other case, the opposite pieces get eaten inside the clustered areas, so mission is accomplished. Now, though I have to think of an improved version.

7. Is there any source code of the game, bacause I cannot find any?