Skip to main content

A python chessboard library for representing game positions.

Project description

chess-board

What is chess-board?

chess-board is a Python chessboard package with a flexible "just a board" API for graphically representing game positions.

What chess-board is not

  • A chess engine
  • A legal move validator
  • A PGN parser

While chess-board is designed to work well with any of these, the idea behind chess-board is that the logic that controls the board should be independent of those other problems.

Entry Points

from chessboard import display

valid_fen = 'rnbqkbnr/pp1ppppp/8/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2'

# Initialization
game_board = display.start()

# Position change/update
display.update(valid_fen, game_board)

# Checking GUI window for QUIT event. (Esc or GUI CANCEL)
display.check_for_quit()

# Close window
display.terminate()

Usage

test.py - example

from chessboard import display

valid_fen = 'rnbqkbnr/pp1ppppp/8/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2'

game_board = display.start()

while True:
    display.check_for_quit()
    display.update(valid_fen, game_board)

display.terminate()

Installation

Download and install the latest release:

# install into virtualenv
source env/bin/activate
pip install chess-board

or 

# install with pipenv
pipenv install chess-board

or

# install system-wide
pip install chess-board

Alternatively, you could git clone this repo and add the directory to your package.

git clone https://github.com/ahira-justice/chess-board.git

Dependencies

pygame==2.1.2

chess-board installation automatically installs latest pygame version.

License

GNU GENERAL PUBLIC LICENSE

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chess-board-0.3.1.tar.gz (37.1 kB view details)

Uploaded Source

Built Distribution

chess_board-0.3.1-py2.py3-none-any.whl (37.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file chess-board-0.3.1.tar.gz.

File metadata

  • Download URL: chess-board-0.3.1.tar.gz
  • Upload date:
  • Size: 37.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.7

File hashes

Hashes for chess-board-0.3.1.tar.gz
Algorithm Hash digest
SHA256 e1ce69532ec2ce30f1349a3e8ae2364d4ea2674e871ebbb8a04094819e8a7469
MD5 19968e50c5a96b4b46801b4f88416084
BLAKE2b-256 f5a04c1f1d0f183d5c21e85eaec3bdf3c4472de92dfb85ce641e311eb1e405e3

See more details on using hashes here.

File details

Details for the file chess_board-0.3.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for chess_board-0.3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 cf8f944d9a4dd887d39df9b3e640ed788a9ce268b2ee182df84cb9e81dc40f7f
MD5 1d2df03bf4667b01094fffba0a104aa8
BLAKE2b-256 555fdfbaa87c10880d7debac8a7582a2f59933f7143c907a12670ebc71769aa4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page