|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectGameBoard
OthelloBoard
public class OthelloBoard
This class manages the data necessary for an Othello board.
| Field Summary |
|---|
| Fields inherited from class GameBoard |
|---|
NOTHING, P1, P2 |
| Constructor Summary | |
|---|---|
OthelloBoard()
Constructor for starting a game with an empty board |
|
| Method Summary | |
|---|---|
boolean |
checkAvailability()
Examines the board for a given player and checks if there are any available moves to make for that player |
void |
chooseCell(int row,
int col,
int player)
Method to allow a player to select a cell. |
OthelloBoard |
clone()
Method for making a duplicate of the current configuration of the board |
int |
flipLeft(int row,
int col,
int player)
Recursive method to try and flip pieces of opposing player going left |
int |
flipLow(int row,
int col,
int player)
Recursive method to try and flip pieces of opposing player going down |
int |
flipLowerLeft(int row,
int col,
int player)
Recursive method to try and flip pieces of opposing player going lower left |
int |
flipLowerRight(int row,
int col,
int player)
Recursive method to try and flip pieces of opposing player going lower right |
int |
flipRight(int row,
int col,
int player)
Recursive method to try and flip pieces of opposing player going right |
int |
flipUp(int row,
int col,
int player)
Recursive method to try and flip pieces of opposing player going up |
int |
flipUpperLeft(int row,
int col,
int player)
Recursive method to try and flip pieces of opposing player going upper left |
int |
flipUpperRight(int row,
int col,
int player)
Recursive method to try and flip pieces of opposing player going upper right |
int |
getWinner()
Determines who has won the game. |
boolean |
isLegalMove(java.awt.Dimension testMove)
This method checks if the selected move is allowed by the current player |
void |
resetBoard()
Method to reset the entire board, assigning all cells to have value of NOTHING. |
void |
skipTurn()
Method for skipping the current player's turn |
| Methods inherited from class GameBoard |
|---|
getCell, getTurn |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public OthelloBoard()
| Method Detail |
|---|
public OthelloBoard clone()
clone in class java.lang.Object
public void chooseCell(int row,
int col,
int player)
chooseCell in class GameBoardrow - - row of the chosen cellcol - - column of the chosen cellplayer - - the player who is making this movepublic boolean checkAvailability()
- - player - the player that is being analyzed
public int flipUpperLeft(int row,
int col,
int player)
row - - row of the disccol - - column of the discplayer - - the player who is trying to flip
public int flipUp(int row,
int col,
int player)
row - - row of the disccol - - column of the discplayer - - the player who is trying to flip
public int flipUpperRight(int row,
int col,
int player)
row - - row of the disccol - - column of the discplayer - - the player who is trying to flip
public int flipRight(int row,
int col,
int player)
row - - row of the disccol - - column of the discplayer - - the player who is trying to flip
public int flipLowerRight(int row,
int col,
int player)
row - - row of the disccol - - column of the discplayer - - the player who is trying to flip
public int flipLow(int row,
int col,
int player)
row - - row of the disccol - - column of the discplayer - - the player who is trying to flip
public int flipLowerLeft(int row,
int col,
int player)
row - - row of the disccol - - column of the discplayer - - the player who is trying to flip
public int flipLeft(int row,
int col,
int player)
row - - row of the disccol - - column of the discplayer - - the player who is trying to flip
public boolean isLegalMove(java.awt.Dimension testMove)
isLegalMove in class GameBoardtestMove - - the row/column of the move being queried
public int getWinner()
getWinner in class GameBoardpublic void skipTurn()
skipTurn in class GameBoardpublic void resetBoard()
resetBoard in class GameBoard
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||