Skip to content

Repository files navigation

Arche

Andrew's Rust Chess Engine

About

This project is mostly intended for self-edification. The engine is not intended to be particularly novel or powerful.

The board is currently represented using only bitboards (with magic bitboards for move generation of sliding pieces).

The search is alpha beta with a transposition table, iterative deepening, quiescence search and MVV-LVA move ordering. Evaluation is material plus piece square tables.

Usage

The engine does not ship with any GUI. It currently implements a subset of the UCI protocol, you can use it with an open source GUI such as Arena.

The program does not accept posix style arguments it will immediately start in UCI mode.

Binaries for linux, macos and windows are attached to each release. To build from source:

cargo build --release

The binary is written to target/release/arche. Note that the engine allocates a 256MB transposition table on startup and that the size is not yet configurable over UCI.

Strength

Each release plays a short match against its predecessor and the result is added to the release notes. The estimate is only as good as the number of games behind it, which is why the error bar is published alongside it.

Each release also plays a gauntlet against old releases of Stash, which are ranked on the ccrl blitz list, and the rating that implies is added alongside. The engine has not been entered into any rating list itself, and the gauntlet is played faster and on different hardware than the list it borrows its opponents from, so read that figure as a placement to within about a hundred points rather than a rating.

Development

See docs/DEVELOPMENT.md for how to run the tests and benchmarks, play a match against a previous version, and cut a release.

Lichess

docker/Dockerfile builds an image containing lichess-bot, the engine and an opening book, which is enough to run the engine as a bot account on lichess.org. Images are published to ghcr.io/aywrite/arche-lichess-bot, tagged master on every push to master. A release is tagged latest, <major>.<minor>, <version> and v<version>, the last of which matches the git tag and is the one quoted in the release notes along with its digest.

docker run -e LICHESS_BOT_TOKEN=<token> ghcr.io/aywrite/arche-lichess-bot:master

The token is a lichess API token for a bot account with the bot:play scope. The engine allocates a 256MB transposition table, so give the container at least 512MB of memory. To change any other setting, mount a replacement over /lichess-bot/config.yml; the defaults are in docker/config.yml.

The book is generated at build time by docker/build_book.py from lichess-org/chess-openings (CC0). Each move is weighted by the number of named openings that play it, so common theory is chosen far more often than novelties.

To build and check an image locally:

docker build -f docker/Dockerfile -t arche-lichess-bot .
docker/smoke_test.sh arche-lichess-bot

TODO

  • null move pruning
  • killer moves
  • better evaluation
    • mobility in evaluation
    • evaluate drawn positions
    • special cases (bishop pair, open files etc)
  • read an opening book in the engine, only the lichess-bot image has one at the moment and it is lichess-bot that reads it rather than the engine
  • the rest of the uci protocol
    • setoption is not handled and no options are advertised, so the 256MB transposition table can only be changed in code
    • stop is not handled, which rules out pondering and go infinite
    • ponderhit, debug and register are not handled either
  • winboard
  • known issues
    • fail low nodes (upper bounds) are never stored in the transposition table, only exact scores and fail highs
    • a transposition score that came from a repetition or fifty move draw is refused rather than trusted, so the search cannot read a draw down a path that could not reach it. The reverse direction is still open: a score stored with the draw out of reach can be read by a path with the draw in reach, say a fifty move counter about to run out, and be trusted
    • a fen is only validated as far as what the search cannot survive, a king a side and the side not to move being out of check. A position which is illegal in other ways, such as one with nine pawns or castling rights without a rook, is accepted and played from

Acknowledgements

About

Basic rust chess engine

Resources

Stars

3 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages