Internet Chess ToolKit
v0.2.0

ictk.boardgame.chess
Class ChessGame

java.lang.Object
  extended byictk.boardgame.chess.ChessGame
All Implemented Interfaces:
Game, SingleBoardGame

public class ChessGame
extends java.lang.Object
implements SingleBoardGame

This is a container class to house the ChessGameInfo, ChessBoard and History for the Board.


Field Summary
static boolean BLACK
           
static boolean WHITE
           
 
Constructor Summary
ChessGame()
           
ChessGame(ChessGameInfo _gameInfo)
           
ChessGame(ChessGameInfo _gameInfo, ChessBoard _board)
           
ChessGame(ChessGameInfo _gameInfo, ChessBoard _board, History _hist)
           
 
Method Summary
 java.lang.String dump()
          this is purely for diagnostic purposes.
 boolean equals(java.lang.Object obj)
          compares the history (shallow equals) and gameinfo.
 Board getBoard()
          returns the game board (if more than one it returns the first board which might be arbitrary.
 Board[] getBoards()
          Board games with only one board return a single element Board[] array.
 Result getCurrentResult()
          returns the current status of this Game.
 GameInfo getGameInfo()
          this returns the GameInfo object for this game.
 History getHistory()
          returns the move history for the entire game.
 int getNumberOfPlayers()
          gets the number of players involved in this type of game, though there might not be two valid Player objects for this game.
 int[] getPlayersToMove()
          returns an array containing the index number of the Players who have the ability to make a move at this time.
 int getPlayerToMove()
          returns 0 if it is White to move, 1 if Black to move.
 Result getResult()
          returns file final result of the game on the main line.
 int hashCode()
           
 void setBoard(Board _board)
          set the board for this game.
 void setGameInfo(GameInfo gi)
           
 void setHistory(History _hist)
           
 void setResult(Result result)
           
 java.lang.String toString()
          this is purely for diagnostic purposes.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

BLACK

public static final boolean BLACK
See Also:
Constant Field Values

WHITE

public static final boolean WHITE
See Also:
Constant Field Values
Constructor Detail

ChessGame

public ChessGame()

ChessGame

public ChessGame(ChessGameInfo _gameInfo)

ChessGame

public ChessGame(ChessGameInfo _gameInfo,
                 ChessBoard _board)

ChessGame

public ChessGame(ChessGameInfo _gameInfo,
                 ChessBoard _board,
                 History _hist)
Method Detail

getNumberOfPlayers

public int getNumberOfPlayers()
Description copied from interface: Game
gets the number of players involved in this type of game, though there might not be two valid Player objects for this game. For example: Chess would always return 2, even if only one player is known. But Scrabble might return 2-6 depending on how many people are playing that particular game.

Specified by:
getNumberOfPlayers in interface Game

getGameInfo

public GameInfo getGameInfo()
Description copied from interface: Game
this returns the GameInfo object for this game. The GameInfo object includes player information as well as where the game was played.

Specified by:
getGameInfo in interface Game

setGameInfo

public void setGameInfo(GameInfo gi)
Specified by:
setGameInfo in interface Game

getHistory

public History getHistory()
Description copied from interface: Game
returns the move history for the entire game. You need to use this object to add moves to the game and navigate through the game's move list.

Specified by:
getHistory in interface Game

getBoard

public Board getBoard()
Description copied from interface: SingleBoardGame
returns the game board (if more than one it returns the first board which might be arbitrary.

Specified by:
getBoard in interface SingleBoardGame

getBoards

public Board[] getBoards()
Description copied from interface: Game
Board games with only one board return a single element Board[] array.

Specified by:
getBoards in interface Game
Returns:
all the boards use in this game.

setResult

public void setResult(Result result)
Specified by:
setResult in interface Game

getPlayerToMove

public int getPlayerToMove()
returns 0 if it is White to move, 1 if Black to move.

Specified by:
getPlayerToMove in interface SingleBoardGame

getPlayersToMove

public int[] getPlayersToMove()
Description copied from interface: Game
returns an array containing the index number of the Players who have the ability to make a move at this time. The numbers can then be sent to GameInfo.getPlayer(int) to receive the Player object.

Specified by:
getPlayersToMove in interface Game

setBoard

public void setBoard(Board _board)
Description copied from interface: SingleBoardGame
set the board for this game.

Specified by:
setBoard in interface SingleBoardGame

setHistory

public void setHistory(History _hist)
Specified by:
setHistory in interface Game

getCurrentResult

public Result getCurrentResult()
Description copied from interface: Game
returns the current status of this Game.

Specified by:
getCurrentResult in interface Game

getResult

public Result getResult()
Description copied from interface: Game
returns file final result of the game on the main line.

Specified by:
getResult in interface Game

toString

public java.lang.String toString()
this is purely for diagnostic purposes.


dump

public java.lang.String dump()
this is purely for diagnostic purposes.


equals

public boolean equals(java.lang.Object obj)
compares the history (shallow equals) and gameinfo. The current state of the board is not evaluated.


hashCode

public int hashCode()

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