E
efialtis
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.
Any idea welcome...
Thank you for your time.
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.
Any idea welcome...
Thank you for your time.