As my first
Java project, I've been trying to implement a game for a few months now, and I need some feedback on one aspect of my implementation because it's causing me some problems.
The game is played on a checkerboard. At the end of the game, players score points for "regions" of adjacent markers in their color.
I'm representing the "contents" of each square ("red marker", "white marker", "empty") as a
string in a 2D array.
For scoring purposes, I'd planned:
1) start at [0][0]
2) check for adjacent squares with the same contents
3) if any match, add them to a list of "squares that are part of this scoring region but have not yet been checked to resolve their own adjacencies"
4) check the squares from (3) for their adjacencies, add any new squares to the list, check THOSE squares for their adjacencies, etc. until there are now more squares left to check on the (3) list. (i.e. this region is completely checked)
My problem is: how to I tell the list in step (3) to add square [4][5] to it?
Would a better implementation have been to have each "square" be an object, with attributes for "contents", "checked", and "needs to be checked" that could be referenced by the scoring code?
Sorry for the long explanation.
Thanks for any help.
Mike