|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectOthelloState
Class used to represent the board during a game of Othello.
Constructor Summary | |
OthelloState()
Initialize the board. |
Method Summary | |
OthelloPiece |
at(int row,
int col)
Return the piece at the given (row,col). |
Object |
clone()
Return a cloned copy of the state. |
OthelloPiece |
currentPlayer()
Return the current player's color, as a OthelloPiece object. |
void |
forfeitMove()
Forfeit the current turn. |
boolean |
gameOver()
Return whether or not the game is over, ie neither Black nor White can make any more moves. |
boolean |
isValidMove(int row,
int col)
Return whether a placement at (row,col) is valid for the current player. |
static boolean |
isValidPosition(int row,
int col)
See if the specified position is valid, in other words: it's on the board. |
void |
makeMove(int row,
int col)
Place a piece in the specified (row,col) position. |
OthelloPiece |
otherPlayer()
Return the player who is not playing this turn. |
OthelloPiece |
winner()
|
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public OthelloState()
Method Detail |
public Object clone()
public static boolean isValidPosition(int row, int col)
row
- The row of the move (0-7).col
- The column of the move (0-7).public OthelloPiece currentPlayer()
public OthelloPiece otherPlayer()
public boolean gameOver()
public OthelloPiece at(int row, int col)
row
- The row of the move (0-7).col
- The column of the move (0-7).public boolean isValidMove(int row, int col)
row
- The row of the move (0-7).col
- The column of the move (0-7).public void makeMove(int row, int col) throws InvalidMoveException
row
- The row of the move (0-7).col
- The column of the move (0-7).
InvalidMoveException
public OthelloPiece winner()
public void forfeitMove() throws InvalidMoveException
InvalidMoveException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |