|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.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 Board
Board.getBoardSize()
public void initializeBoard()
initializeBoard
in interface Board
Board.initializeBoard()
public boolean checkLegalMove(int newMove)
newMove
is empty, false otherwise.
checkLegalMove
in interface Board
newMove
- 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 Board
newMove
- position in which to place next move; must be between >= 0 and < size of boardBoard.updateBoard(int)
public boolean checkForWin()
checkForWin
in interface Board
Board.checkForWin()
public boolean checkForTie()
checkForTie
in interface Board
Board.checkForTie()
public java.lang.String displayBoard()
displayBoard
in interface Board
Board.displayBoard()
public int[] getBoardState()
getBoardState
in interface Board
Board.getBoardState()
public void swap()
Board
swap
in interface Board
Board.swap()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |