Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

Rust Chess Engine (UCI)

This project provides:

  • a progressively stronger chess engine in Rust
  • UCI protocol support (usable in GUIs and match runners)
  • scripts/tools to run matches and estimate Elo

1. Build

cargo build --release

Engine binary:

./target/release/rust_chess_engine

2. Quick UCI smoke test

printf "uci\nisready\nposition startpos moves e2e4 e7e5\ngo depth 4\nquit\n" | ./target/release/rust_chess_engine

Expected output includes:

  • uciok
  • readyok
  • bestmove ...

3. Correctness tests

perft tests are included for the starting position:

cargo test

4. Elo testing workflow

Dependencies

Run one match vs a fixed-strength Stockfish

./scripts/run_vs_stockfish.sh \
  ./target/release/rust_chess_engine \
  stockfish \
  1400 \
  100 \
  10+0.1 \
  ./matches/sf_1400.pgn

This plays 100 games against Stockfish constrained by:

  • UCI_LimitStrength=true
  • UCI_Elo=1400

Estimate Elo delta from PGN

cargo run --bin pgn_elo -- --pgn ./matches/sf_1400.pgn --engine rust-engine

This returns an estimated Elo difference (engine - opponent) and a 95% CI.

Absolute estimate:

engine_elo ~= opponent_elo + elo_delta

Calibrate against "similar levels"

Run a short gauntlet:

./scripts/calibrate_elo.sh \
  ./target/release/rust_chess_engine \
  stockfish \
  "1400 1600 1800 2000" \
  60 \
  10+0.1

Pick the level where your score is near 50%. That level is usually your closest "similar-strength" anchor.

5. Current engine architecture

Search:

  • iterative deepening alpha-beta negamax
  • principal variation search (PVS)
  • transposition table (hash move + bound reuse)
  • killer moves + history heuristic
  • null-move pruning
  • late move reductions (LMR)
  • quiescence search on tactical moves

Evaluation:

  • material + piece-square tables
  • mobility terms
  • pawn-structure terms (isolated/doubled/passed pawns)
  • rook open/semi-open file activity
  • king shelter heuristics
  • bishop pair bonus

Opening phase:

  • built-in opening repertoire for common 1.e4, 1.d4, and 1.c4 structures

6. Notes on depth and time controls

  • With go depth N, search is depth-limited to N.
  • With go movetime ... or go wtime/btime ..., search is time-managed and can keep deepening up to internal max depth.

7. Practical rating note

Elo estimates from short matches can swing a lot. Prefer at least 100-200 games per level for stable conclusions.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages