Re: Finding blocks of symbols on a 2dimensional array
- From: "pemo" <usenetmeister@xxxxxxxxx>
- Date: Mon, 9 Jan 2006 16:46:45 -0000
"efialtis" <efialtis@xxxxxxxxxxx> wrote in message
news:pan.2006.01.09.16.41.59.756751@xxxxxxxxxxxxxx
> Hi to all,
>
> I am creating a program which plays a game. The game is played
> on a NxN square board. In every position of the board we may have
> a ball or not. Take for example the following 5x5 board ( x : ball,
> o : empty space).
>
> x x o o x
> x o o o o
> o o x x o
> o o o x x
> x x o o o
>
> I want to write a function which calculates the number of ball blocks
> on a specific board. For example the above board has 4 ball blocks
> (1 or more balls being surrounded by empty spaces).
>
> The problem is that i cannot think of any elegant algorithm to
> calculate this number.
Sounds like a 'convert to binary' and then do some bit twiddling to me.
.
- References:
- Finding blocks of symbols on a 2dimensional array
- From: efialtis
- Finding blocks of symbols on a 2dimensional array
- Prev by Date: Finding blocks of symbols on a 2dimensional array
- Next by Date: Re: Passing Struct to Function to be Modified then used by Caller
- Previous by thread: Finding blocks of symbols on a 2dimensional array
- Next by thread: Re: Finding blocks of symbols on a 2dimensional array
- Index(es):
Relevant Pages
|