Internet Chess ToolKit
v0.2.0

Package ictk.boardgame.chess

This is the implementation of the Chess game model.

See:
          Description

Class Summary
Bishop the Bishop piece for the game of chess
ChessBoard This is the playing board.
ChessGame This is a container class to house the ChessGameInfo, ChessBoard and History for the Board.
ChessGameInfo This is a data class that contains player's, setting, date etc
ChessMove ChessMove is an implementation of the Command Pattern of OOD.
ChessPiece  
ChessPlayer A ChessPlayer is usually a person, but could be a computer or a Team if it implements the appropriate interface.
ChessResult Setting this for a particular move indicates the termination of the chess game.
ChessTeam A ChessPlayer that involves several members, possibly playing as a team in one game.
King  
Knight  
Pawn  
Queen  
Rook  
Square this is a typical location on a chess board.
 

Exception Summary
AmbiguousChessMoveException some notations use shorthand for moves that relies on a particular position on the board.
 

Package ictk.boardgame.chess Description

This is the implementation of the Chess game model. It contains all the elements necessary to determine legal moves on the chess board. By using History in conjunction with a ChessBoard you can play moves on the board, take them back and create variations to the normal course of play.

The model works by having each of the pieces determine their own legal moves. Because of this overtly OOP approach this library is not well suited for computationally intensive tasks such as chess engines. It was not designed for that purpose.

The following is an a quick example of how to use the this package:


   ChessGame game = new ChessGame();
   ChessBoard board = (ChessBoard) game.getBoard();
   History history = game.getHistory();
   ChessMove move = null;
   SAN san = new SAN();

   try {
      move = san.stringToMove(board, "e4");
      history.add(move);
      move = san.stringToMove(board, "e5");
      history.add(move);
   }
   catch (AmbiguousChessMoveException e) {
      System.err.println(e);
   }
   catch (IllegalMoveException e) {
      System.err.println(e);
   }
   
There are many ways to do this. For example you don't need to use the SAN (Standard Algebraic Notation) object to create moves, instead you can use the constructor of ChessMove. Also you don't need to use the History object to play the moves on the board, but you should read ChessBoard's comments on the side-effects of that method.


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