Skip to content

curoli/sanqi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sanqi (三棋)

Sanqi (三棋, Sānqí) board game engine.

Here are the rules of Sanqi in English 🇬🇧, German 🇩🇪, Indonesian 🇮🇩, Arabic 🇸🇦, Chinese 🇨🇳, Spanish 🇪🇸, and Turkish 🇹🇷.

Play

You can play Sanqi from the command line with the Rust CLI:

cargo run --release -p sanqi-cli -- play

For repeated use, you can also install the CLI:

cargo install --path crates/sanqi-cli --locked
sanqi play

Examples:

cargo run --release -p sanqi-cli -- play normal human machine
cargo run --release -p sanqi-cli -- play think machine machine

This 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-d4

Useful commands inside the CLI:

  • moves lists legal moves
  • hint asks the engine for a recommendation
  • svg a1-b3 shows an annotated SVG for a move
  • quit exits 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.

Releasing

Tag pushes like v0.1.0 trigger release workflows for:

  • sanqi-core, sanqi-engine, and sanqi-render on crates.io
  • sanqi-python on PyPI

Before the first release, configure:

  • a GitHub Actions secret CARGO_REGISTRY_TOKEN for crates.io
  • a PyPI Trusted Publisher for the pypi GitHub environment

Release details are collected in RELEASING.md, and user-facing changes in CHANGELOG.md.

About

Sanqi board game engine

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages