py-draughts

py‑draughts

The fastest pure-Python draughts / checkers library — bitboard move generation ~200× faster than pydraughts. Built-in alpha-beta engine, HUB protocol bridge (Scan, Kingsrow), web UI, SVG rendering, and ML/RL helpers across 8 variants: International, American, Frisian, Russian, Brazilian, Antidraughts, Breakthrough, and Frysk!.

PyPI Downloads GitHub
Quick Start

Spin up a board, push moves, query legal moves, parse PDN/FEN. The 5-minute path to a working game.

Core API
Engine

Built-in alpha-beta engine, Hub protocol bridge, and a clean Engine interface for plugging in your own.

Engine
AI / RL

Tensor representations, legal-move masks, MCTS skeleton, and a complete REINFORCE self-play example.

Writing Your Own AI
Web UI

Drop-in FastAPI server with a polished UI for play, analysis, and engine matches.

Server
SVG Rendering

Render boards and pieces with arrows, highlights, and full Jupyter notebook integration.

SVG Rendering
Benchmarks

Performance numbers for legal-move generation and engine search, plus the tooling used to produce them.

Benchmarking (Internal)
vs pydraughts

Side-by-side comparison: speed, variants, engine, web UI, ML support. Why py-draughts is ~200× faster.

py-draughts vs pydraughts

Installation

pip install py-draughts
uv add py-draughts
poetry add py-draughts

Hello, draughts

from draughts import Board, AlphaBetaEngine

board = Board()                       # 10x10 international draughts
board.push_uci("31-27")
board.push_uci("18-22")

engine = AlphaBetaEngine(depth_limit=5)
board.push(engine.get_best_move(board))

print(board)

Variants

Class

Size

Flying kings

Notes

draughts.StandardBoard

10×10

Yes

International draughts / FMJD (alias: draughts.Board)

draughts.AmericanBoard

8×8

No

English checkers

draughts.FrisianBoard

10×10

Yes

Diagonal + orthogonal captures

draughts.RussianBoard

8×8

Yes

Mid-capture promotion

draughts.BrazilianBoard

8×8

Yes

International rules on 8×8

draughts.AntidraughtsBoard

10×10

Yes

Lose all pieces (or get blocked) to win

draughts.BreakthroughBoard

10×10

Yes

First player to make a king wins

draughts.FryskBoard

10×10

Yes

Frisian rules with 5 men per side