|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.tabacha.cgo.tournament.TournamentGame
Represents one game of conwaygo: two players and a board.
$Id: TournamentGame.java,v 1.9 2004/12/23 21:42:44 mk Exp $
Field Summary |
Fields inherited from interface de.tabacha.cgo.Constants |
BALL, COL_COUNT, DCOL, DOWN, DROW, E, EMPTY, FIRST_DIRECTION, KICK_OFF_FIELD, LAST_DIRECTION, N, NE, NW, OPPOSITE, PIECE, ROW_COUNT, S, SE, SW, UP, UPSIDEDOWN, W |
Constructor Summary | |
TournamentGame(Engine playerUp,
Engine playerDown)
Constructor. |
Method Summary | |
void |
addGameListener(GameListener listener)
Adds a GameListener that will be notified of game events. |
int |
averageTime(boolean direction)
|
protected void |
fireGameAborted(boolean direction,
Move move,
java.lang.String message)
Method to support listener events. |
protected void |
fireGameEnded(boolean winnerDirection)
Method to support listener events. |
protected void |
fireGameStarted()
Method to support listener events. |
protected void |
fireHasMoved(Move move,
boolean direction)
Method to support listener events. |
protected void |
firePlayerChanged(boolean newPlayerDirection)
Method to support listener events. |
Board |
getBoard()
Returns the board with the game position. |
int |
getMoveCount()
Returns the number of moves played in the game. |
Engine |
getPlayer(boolean direction)
Returns the routine that makes the moves in the specified direction. |
Engine |
getPlayerToMove()
Returns the player who has to move now. |
boolean |
getWinner()
Returns the playing direction of the winner of the game. |
void |
play()
Starts playing the game. |
void |
removeGameListener(GameListener listener)
Removes a GameListener. |
void |
setPlayer(boolean direction,
Engine player)
Sets the routine that makes the moves in the specified direction. |
long |
usedTime(boolean direction)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TournamentGame(Engine playerUp, Engine playerDown)
Method Detail |
public Engine getPlayer(boolean direction)
Game
getPlayer
in interface Game
public Engine getPlayerToMove()
getPlayerToMove
in interface Game
public void setPlayer(boolean direction, Engine player)
setPlayer
in interface Game
public Board getBoard()
getBoard
in interface Game
public boolean getWinner()
public int getMoveCount()
public void addGameListener(GameListener listener)
Game
addGameListener
in interface Game
public void removeGameListener(GameListener listener)
Game
removeGameListener
in interface Game
protected void fireGameStarted()
protected void fireGameAborted(boolean direction, Move move, java.lang.String message)
protected void fireGameEnded(boolean winnerDirection)
protected void fireHasMoved(Move move, boolean direction)
protected void firePlayerChanged(boolean newPlayerDirection)
public void play() throws java.lang.IllegalStateException
Game
play
in interface Game
java.lang.IllegalStateException
- If a player is null or the game is already running.public int averageTime(boolean direction)
public long usedTime(boolean direction)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |