de.tabacha.cgo
Interface Game

All Known Subinterfaces:
BackgroundGame
All Known Implementing Classes:
DefaultGame, TournamentGame

public interface Game

A data model for a game of ConwayGo.
$Id: Game.java,v 1.7 2004/07/30 21:05:58 mk Exp $

Version:
$Revision: 1.7 $

Method Summary
 void addGameListener(GameListener listener)
          Adds a GameListener that will be notified of game events.
 Board getBoard()
          Returns the board with the game position.
 Engine getPlayer(boolean direction)
          Returns the routine that makes the moves in the specified direction.
 Engine getPlayerToMove()
          Returns the player that has to move now.
 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.
 

Method Detail

addGameListener

public void addGameListener(GameListener listener)
Adds a GameListener that will be notified of game events.


removeGameListener

public void removeGameListener(GameListener listener)
Removes a GameListener. Nothing will happen if the listener has not been registered.


getPlayer

public Engine getPlayer(boolean direction)
Returns the routine that makes the moves in the specified direction.


getPlayerToMove

public Engine getPlayerToMove()
Returns the player that has to move now.


setPlayer

public void setPlayer(boolean direction,
                      Engine player)
Sets the routine that makes the moves in the specified direction.


getBoard

public Board getBoard()
Returns the board with the game position.


play

public void play()
          throws java.lang.IllegalStateException
Starts playing the game. Listeners are informed of game events, so no return values are necessary.

Throws:
java.lang.IllegalStateException - If a player is null or the game is already running.