Chessboard

ChessBoard – 2.05

Download this Zipfile:     ChessBoard_2.05   (Right click then “save target as”)

ChessBoard is an implementation of the laws of chess. It validates moves, tests game states, tests for checkmate etc. It is not a chess engine.

ChessBoard was written by  John Eriksson (wmjoers) but he no longer supports it.

He has allowed me to distribute the last version 2.05 from this web site, but please note it is unsupported. The zipfile contains:

  • ChessBoard.py    — the library file, just put it in the same directory as your python program
  • ChessClient.py — an example program that uses ChessBoard.py
  • HowToUseChessBoard.txt  — and explanation of all the functions/methods in the library.
  • Image files to support the example.

There is more than enough in the package to write your own chess interface using ChessBoard.

Description

ChessBoard is a Python implementation of the FIDE laws of chess. The main goal is to implement all applicable rules in a simple, straightforward way. The intention is not to be fast but to be easy to understand and to be complete. Many other implementation has known problems with castling, stalemate or other more or less special rules.Features:

  • The moves of the pieces
  • Castling
  • En passant
  • Check detection
  • Checkmate detection
  • Stalemate detection
  • Draw by the fifty moves rule detection
  • Draw by the three repetitions rule detection
  • Get valid locations support
  • Imoprt and export of Forsyth-Edwards Notation strings.
  • Add text moves in the AN, SAN and LAN standards.
  • Export moves in the AN, SAN and LAN standards.
  • Undo and Redo.
  • Goto a specified move.

Unpack the source and start example with “python ChessClient.py”

Keys:

  • Left – Undo last move.
  • Right – Redo move.
  • F – Print current board as FEN.
  • A – Print all moves as Algebraic Notation.
  • S – Print all moves as Standard Algebraic Notation.
  • L – Print all moves as Long Algebraic Notation.

5