Notes from ADT Meeting
"Has" = public data meber or a private
data member with get/set functions
Human Player
Computer Player
int main() {
Game game (...);
boolean OK = game.preGame();
if (OK) {
OK = game.mainGame();
}
if (OK) {}
game.postGame();
}
}
Game
has score
has turn (C/P)
has grid
maybe the two players
private: int theScore;
public:
int getScore();
void setCore(int newScore);
quit()
preGame
mainGame()
postGame()
Grid
has a size
has boxes, dots, edges
bool isEdgeFilled(Edge);
boid fill(Edge)l
char whoHasClaimed(Box);
void claim(Box, char player);
bool isBoxCompleted();
bool isLegal(Dot);
bool isLegal(Edge);
bool isLegal(Box);
Box
has edges
may have player claim (' ', 'C', 'H')
Edge getEdge(int i); // i = 0,1,2,3
or
Edge getLeftEdge()
Edge getRightEdge()
Edge getUpperEdge()
Edge getLowerEdge()
Edge
could be vertical or horizontal
has dots
Dot getLowerLeftDot();
Dot getUpperRightDot();
Box getBox1();
Box getBox2();
Dot
x, y
So Dots, Boxes, Edges are really just locations within the grid.
They don't store the game information.
Move
maybe has Edge, Player (H/C)
© 2017, Old Dominion Univ.