Actually a bit more than a variable move made it necessary to refoactor every thing.
O.K., the CBoard class is purely about the playing field. The reason why earlier versions placed movement functionality here was confusion about the similarity between checking for possible movement paths and checking for neighbouring regions.
So, the minimum required for the CBoard class is (ignoring Singleton issues) drawing the board and retrieving board and region information. The functions about neighbourhoods can be skipped as there is no special or missing neighbouring cells to be concerned with.
The named constants:
Private;
drawing constants for the playing field, and
number of cells
Public:
OFF_BOARD.
Variables:
Private;
array of regions for selecting pieces, and
array of regiond for selecting playing regions.
Static Functions (no need to create or release instances to call these):
Public;
retrieve dimensions of layout (number of cells for each direction), and
check that location (x,y) is in bounds.
Functions:
Public;
retrieve the region for location (x,y),
match location (x,y) to point,
drawing,
retrieving the size of the playing field (in pixels), and
Singleton functionality.
No comments:
Post a Comment