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
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
Built Distribution
File details
Details for the file chess-board-0.3.0.tar.gz
.
File metadata
- Download URL: chess-board-0.3.0.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36575e5f3f976e880d6086d01c1721cea5e71642d4b1cb867179d6be608d8927 |
|
MD5 | f9298770b1dd673b5eb8806fd245f8ce |
|
BLAKE2b-256 | 685514c7e162923c1b67ab1ad1510ee92153b28fb81dce94583cd501b721e0b9 |
File details
Details for the file chess_board-0.3.0-py2.py3-none-any.whl
.
File metadata
- Download URL: chess_board-0.3.0-py2.py3-none-any.whl
- Upload date:
- Size: 37.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebb6273d91c4e2ab6fb7f34ecfb40684f9c47786f471b768c2ec9aca4fd381da |
|
MD5 | dcc1003cf401ed6e729e166f0374ae3f |
|
BLAKE2b-256 | 8dc9e18b12e4dca8ef9690c641e09d74b79cf9c803458bdeff1dda472485a217 |