13 releases

Uses new Rust 2024

new 0.0.13 May 16, 2026
0.0.12 May 16, 2026

#1438 in Algorithms

Unlicense

290KB
5K SLoC

ruchess

rust chess

docs

features

  • highly compact bitboard representations
  • zobrist hashing
  • magic attack tables
  • move generation & validation
  • outcome evaluation (checkmate, stalemate, repetition, insufficient material)
  • fen parsing
  • immutable
  • hella docs
  • really really really fast (relatively)

i only support standard chess. it is unlikely i will support other variants.

probably check out shakmaty if you want more features

quickstart

Caution

this is library is still at version 0.0.X

it is very likely that there will be breaking api changes until version 0.1.0

if you use this library, make sure you pin the version in cargo.toml

cargo add ruchess

or in your cargo.toml

[dependencies]
ruchess = "0.0.4"
use ruchess::game::Game;
use ruchess::square;

// Play 1.e4 from the standard starting position.
let game = Game::new();
let after_e4 = game.mve(square::E2, square::E4).unwrap();
assert!(after_e4.position().board().is_occupied(square::E4));

see: docs for more details

see: examples or ruchess tui for example applications

dependencies

  • arrayvec to allocate generated moves on stack

roadmap

  • benchmarks
    • will move to mutable api if benchmarks are very bad (update: working on performance)
  • parsing
    • fen
    • pgn
    • san
    • uci
  • real uci support
  • finalise public api

benchmarks

simple and benchmarking using perft to get an estimation of performance

results in benchmark_results/

code in examples/perft.rs

benchmarks were ran on m1 macbook pro

we generate roughly 212 Mn/s

for reference, shakmaty generates roughly 223 Mn/s

we are currently about 5% slower.

license

unlicense

Dependencies