Pewter is a hobby chess engine written from scratch in the Rust programming language. It is not a complete chess program — it speaks the UCI protocol over stdin/stdout and is meant to be driven by a chess GUI or by another program, rather than used directly.
The project is a Cargo workspace:
| Crate | Kind | Description |
|---|---|---|
pewter-core |
library | Board representation, move generation, FEN/PGN/UCI parsing, Zobrist hashing. |
pewter-engine |
binary | The UCI engine itself (pewter-engine), plus search and evaluation. |
pewter-opening-db-builder |
binary | Scrapes games and builds the opening book used by the engine. |
pewter-search-debugger |
binary | Runs a single search on a position for debugging, without the UCI loop. |
pewter-stockfish-comparer |
binary | Compares Pewter's evaluation/search against Stockfish. |
Pewter targets a recent stable Rust toolchain and uses the 2024 edition, so it needs Rust 1.85 or newer. Install Rust via rustup if you don't already have it.
# Debug build of everything
cargo build --workspace
# Optimised build (use this for actually playing — it is dramatically stronger
# per unit time than the debug build)
cargo build --releaseThe release engine binary is written to target/release/pewter-engine.
# Run the test suite
cargo test --workspace
# Formatting, lints and micro-benchmarks
cargo fmt --all --check
cargo clippy --workspace --all-targets -- -D warnings
cargo bench -p pewter-coreThese are the same checks the CI workflow runs on every push and pull request.
pewter-engine is a UCI engine: it reads UCI commands on stdin and writes
responses on stdout. You can talk to it by hand to sanity-check it:
$ cargo run --release --bin pewter-engine
uci
# ... engine identifies itself and lists its options, ending with `uciok`
position startpos moves e2e4 e7e5
go depth 8
# ... engine searches and replies with `bestmove ...`
quitSupported UCI options include Hash (transposition table size in MiB) and the
Wobble / WobblePlies pair used to add controlled randomness to the opening
(handy for generating varied self-play games).
Any UCI-compatible GUI can drive Pewter. Build a release binary and register
target/release/pewter-engine as a new UCI engine in your GUI of choice, for
example:
The GUI handles the board, clocks and opponent; Pewter just needs the path to the binary.
The tourney/ directory contains a Python harness for A/B-testing
engine changes: it plays two UCI engines against each other over many games and
reports the score, Elo difference and likelihood of superiority. See
tourney/README.md for details.
crates/— the Rust workspace (see the table above).tourney/— Python tournament harness for comparing engine builds.docs/— design notes, including the engine-strength roadmap.
Pewter is distributed under the terms of the MIT license.