Sanqi (三棋, Sānqí) board game engine.
Here are the rules of Sanqi in English 🇬🇧, German 🇩🇪, Indonesian 🇮🇩, Arabic 🇸🇦, Chinese 🇨🇳, Spanish 🇪🇸, and Turkish 🇹🇷.
You can play Sanqi from the command line with the Rust CLI:
cargo run --release -p sanqi-cli -- playFor repeated use, you can also install the CLI:
cargo install --path crates/sanqi-cli --locked
sanqi playExamples:
cargo run --release -p sanqi-cli -- play normal human machine
cargo run --release -p sanqi-cli -- play think machine machineThis starts an interactive game. Moves use the format a1-b3.
Game scores can also be written in a simple PGN-like movetext:
1. h1-d3 h8-d6 2. a1-d4
You can format a move list as movetext with:
cargo run --release -p sanqi-cli -- record h1-d3 h8-d6 a1-d4Useful commands inside the CLI:
moveslists legal moveshintasks the engine for a recommendationsvg a1-b3shows an annotated SVG for a movequitexits the game
You can also access the engine from Python:
import sanqi_python as sanqi
position = sanqi.Position.initial()
print(position.ascii_board())
print(position.legal_moves())
move = position.best_move(2)
if move is not None:
position.apply_move(move)
print(position.ascii_board())For more details, see crates/sanqi-cli/README.md and crates/sanqi-python/README.md.
Tag pushes like v0.1.0 trigger release workflows for:
sanqi-core,sanqi-engine, andsanqi-renderoncrates.iosanqi-pythonon PyPI
Before the first release, configure:
- a GitHub Actions secret
CARGO_REGISTRY_TOKENforcrates.io - a PyPI Trusted Publisher for the
pypiGitHub environment
Release details are collected in RELEASING.md, and user-facing changes in CHANGELOG.md.