Internet Chess ToolKit
v0.2.0

ictk.boardgame
Interface Board

All Known Implementing Classes:
ChessBoard

public interface Board

Defines the board the game is played on. Some games have more than one board. When this is the case the getLegalMoves() functions will report the legal moves on that board, not legal moves in the game.


Method Summary
 void addBoardListener(BoardListener bl)
          add a listener for board updates
 void fireBoardEvent(int event)
          this is used by controllers (such as History) to fire board events to BoardListeners.
 BoardListener[] getBoardListeners()
           
 int getLegalMoveCount()
          returns the number of legal moves possible on the current board.
 java.util.List getLegalMoves()
          returns a List of all legal moves for the current board state.
 int getPlayerToMove()
           
 boolean isInitialPositionDefault()
          Returns true if the very first position on this board is the traditional default position for this type of game; instead of the first position being a position found in the middle of a game.
 boolean isLegalMove(Move m)
           
 void playMove(Move m)
          this is a rather short-sighted function.
 void removeBoardListener(BoardListener bl)
           
 void setPositionClear()
          clears the board of all pieces.
 void setPositionDefault()
          sets the board to the default position for the game.
 

Method Detail

setPositionDefault

public void setPositionDefault()
sets the board to the default position for the game.


isInitialPositionDefault

public boolean isInitialPositionDefault()
Returns true if the very first position on this board is the traditional default position for this type of game; instead of the first position being a position found in the middle of a game.


setPositionClear

public void setPositionClear()
clears the board of all pieces. Depending on the type of game this may be also the default board position.


getLegalMoves

public java.util.List getLegalMoves()
returns a List of all legal moves for the current board state.


getLegalMoveCount

public int getLegalMoveCount()
returns the number of legal moves possible on the current board.


isLegalMove

public boolean isLegalMove(Move m)

getPlayerToMove

public int getPlayerToMove()

playMove

public void playMove(Move m)
              throws IllegalMoveException,
                     OutOfTurnException
this is a rather short-sighted function. It plays the move on the board, but does not add it to the recorded History for the game. this means that using the two in combination (History.add() and playMove()) will seriously FUBAR the state of the board.

Throws:
IllegalMoveException
OutOfTurnException

addBoardListener

public void addBoardListener(BoardListener bl)
add a listener for board updates


removeBoardListener

public void removeBoardListener(BoardListener bl)

getBoardListeners

public BoardListener[] getBoardListeners()

fireBoardEvent

public void fireBoardEvent(int event)
this is used by controllers (such as History) to fire board events to BoardListeners. It also good to use this function to update all BoardListeners on things like a position change, instead of updating the displays individually.

Parameters:
event - the BoardEvent. you wish to send to listeners

Submit a bug or feature
Visit the Website
Internet Chess ToolKit is licensed under the GPL v2 .