|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.anji.gomoku.GomokuBoard
public class GomokuBoard
Represents the playing area of Gomoku.
| Constructor Summary | |
|---|---|
GomokuBoard(int aSize)
Initialize board to be a square with each side of length aSize |
|
| Method Summary | |
|---|---|
boolean |
checkForTie()
|
boolean |
checkForWin()
|
boolean |
checkLegalMove(int newMove)
Return true if position newMove is empty, false otherwise. |
java.lang.String |
displayBoard()
|
int |
getBoardSize()
|
int[] |
getBoardState()
|
void |
initializeBoard()
initialize all positions to empty. |
void |
swap()
swap all friendly pieces for opponent and vice versa |
void |
updateBoard(int newMove)
Place friendly piece in position newMove in array boardState. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GomokuBoard(int aSize)
aSize
aSize - | Method Detail |
|---|
public int getBoardSize()
getBoardSize in interface BoardBoard.getBoardSize()public void initializeBoard()
initializeBoard in interface BoardBoard.initializeBoard()public boolean checkLegalMove(int newMove)
newMove is empty, false otherwise.
checkLegalMove in interface BoardnewMove - position in which to place next move
newMove would create an invalid board state, true otherwiseBoard.checkLegalMove(int)public void updateBoard(int newMove)
newMove in array boardState.
updateBoard in interface BoardnewMove - position in which to place next move; must be between >= 0 and < size of boardBoard.updateBoard(int)public boolean checkForWin()
checkForWin in interface BoardBoard.checkForWin()public boolean checkForTie()
checkForTie in interface BoardBoard.checkForTie()public java.lang.String displayBoard()
displayBoard in interface BoardBoard.displayBoard()public int[] getBoardState()
getBoardState in interface BoardBoard.getBoardState()public void swap()
Board
swap in interface BoardBoard.swap()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||