A draughts library for Python with move generation, PDN reading and writing, engine communication and balloted openings
Project description
pydraughts
pydraughts is a draughts library for Python with move generation, PDN reading and writing, engine communication and balloted openings. It is based on ImparaAI/checkers.
Installing
Download and install the latest release:
pip install pydraughts
Features
Note: White always starts. Black always has the squares starting from 1 (e.g. 1-20 in international draughts).
Variants:
- Standard (International)
- Frisian
- frysk!
- Antidraughts
- Breakthrough
- Russian
- Brazilian
- English/American
- Italian
- Turkish
Engine protocols:
- Hub
- DXP
- CheckerBoard
PDN Reading and Writing
- Import pydraughts
from draughts import Game, Move
- Create a game
game = Game(variant="standard", fen="startpos")
- Make a move
game.move([34, 30])
- Get legal moves
moves, captures = game.legal_moves()
- Convert move to other types
move = Move(game, board_move=moves[0]).pdn_move
- Get fen
fen = game.get_li_fen()
- Communicate with engines
from draughts.engine import HubEngine, Limit
engine = HubEngine("scan.exe hub")
engine.init()
limit = Limit(time=10)
engine_move = engine.play(game, limit, ponder=False)
- Read PDN games
from draughts.PDN import PDNReader
games = PDNReader(filename=filepath)
game = games.games[0]
moves = game.moves
- Write PDN games
from draughts.PDN import PDNWriter
games = PDNWriter(filename=filepath, board=game)
- Get a ballot
from draughts.ballots import Ballots
ballots = Ballots('english')
ballot1 = ballots.get_ballot()
ballot2 = ballots.get_ballot()
Acknowledgements
Thanks to RoepStoep for his draughtsnet which was modified to add support for Hub engines. Thanks to akalverboer for their DXC100_draughts_client which was modified to add support for DXP engines.
License
pydraughts is licensed under the GPL 3 (or any later version at your option). Check out LICENSE
for the full text.
The licenses of the other projects that pydraughts uses are in the other_licenses
folder.
Project details
Release history Release notifications | RSS feed
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
Hashes for pydraughts-0.4.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bad20692939b0a2a06446a4b727372ab1d0e1c7dfbc62b0aedcfd4d02bb3583b |
|
MD5 | e3adf64f75ba3c78736d548c4d31f0d0 |
|
BLAKE2b-256 | 77c9aa7d875fc59598f51aa7a384812521682c1f6b5d4551ad7b2c4728fb2677 |