|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--Board
The Board class represents the 3 by 3 grid on which players make their marks in the game Tic Tac Toe. Bugs: none known
| Constructor Summary | |
Board()
Constructs a 3 by 3 grid with empty cells for the playing board. |
|
| Method Summary | |
boolean |
cellFree(Move move)
Checks if the cell is empty at the location of a specified move. |
boolean |
checkCol(int col,
Mark mark)
Checks for "three in a row", for a specified column and mark. |
boolean |
checkDiag(int diag,
Mark mark)
Checks for "three in a row", for a specified diagonal and mark. |
boolean |
checkRow(int row,
Mark mark)
Checks for "three in a row", for a specified row and mark. |
void |
display()
Displays the board in the console window. |
void |
markMove(Move move,
Mark mark)
Puts a player's mark in the cell corresponding to the specified move. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public Board()
| Method Detail |
public void markMove(Move move,
Mark mark)
move - the specified move (i.e. row and column coordinates)mark - the player's mark to be made on the board, typically "X" or "O"public void display()
public boolean cellFree(Move move)
move - the specified move (i.e. row and column coordinates)
public boolean checkRow(int row,
Mark mark)
row - the row specified to be checked, must be 1, 2, or 3mark - the mark specified to be matched
public boolean checkCol(int col,
Mark mark)
col - the column specified to be checked, must be 1, 2, or 3mark - the mark specified to be matched
public boolean checkDiag(int diag,
Mark mark)
diag - the diagonal specified to be checked, must be 1 or 2
1 is the diagonal from upper-left to lower-right
2 is the diagonal from upper-right to lower-leftmark - the mark specified to be matched
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||