|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.anji.ttt.TttBoard
public class TttBoard
Tic-Tac-Toe board.
Constructor Summary | |
---|---|
TttBoard()
|
Method Summary | |
---|---|
boolean |
checkForTie()
|
boolean |
checkForWin()
|
boolean |
checkLegalMove(int newMove)
|
java.lang.String |
displayBoard()
|
int |
getBoardSize()
|
int[] |
getBoardState()
|
void |
initializeBoard()
initialize board with all empty spaces |
void |
swap()
swap all friendly pieces for opponent and vice versa |
void |
updateBoard(int newMove)
Places friendly piece on boardState at position newMove . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TttBoard()
Method Detail |
---|
public void initializeBoard()
initializeBoard
in interface Board
public boolean checkLegalMove(int newMove)
checkLegalMove
in interface Board
newMove
-
newMove
is an empty spacepublic void updateBoard(int newMove)
boardState
at position newMove
.
updateBoard
in interface Board
newMove
- public boolean checkForWin()
checkForWin
in interface Board
public boolean checkForTie()
checkForTie
in interface Board
public java.lang.String displayBoard()
displayBoard
in interface Board
boardState
public int[] getBoardState()
getBoardState
in interface Board
Board.getBoardState()
public void swap()
Board
swap
in interface Board
Board.swap()
public int getBoardSize()
getBoardSize
in interface Board
Board.getBoardSize()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |