Skip to main content

Crate ruchess

Crate ruchess 

Source
Expand description

§ruchess

A chess library built around Bitboards and a persistent, functional API. Every state-changing operation — placing a piece, playing a move, updating castling rights — returns a new value instead of mutating in place.

§At a glance

use ruchess::game::Game;
use ruchess::square;
use ruchess::uci::Uci;

// Play 1.e4 from the standard starting position.
let game = Game::new();
let after_e4 = game.mve(&Uci { orig: square::E2, dest: square::E4, promotion: None }).unwrap();
assert!(after_e4.position().board().is_occupied(square::E4));

§Module map

  • bitboard — 64-bit board representation and bitwise operations.
  • square, rank, [file] — coordinate primitives.
  • color, role, piece, side — piece and side identifiers.
  • board — piece placement, attack detection, and queries.
  • attacks, magic — precomputed attack tables and magic bitboards.
  • mve, uci — move representation and UCI parsing.
  • castles, unmoved_rooks — castling rights and rook tracking.
  • halfmoveclock, ply — clocks for the fifty-move rule and side to move.
  • hash — Zobrist hashing and repetition trails.
  • history — per-position history (last move, castles, clock, hashes).
  • position — a complete game state with legal-move generation.
  • outcome — terminal results (win, draw, draw reason).
  • game — high-level wrapper that tracks turns and outcomes.
  • fen — fen parser.

Modules§

attacks
Precomputed Attack Tables
bitboard
Bitboards
board
Board
castles
Castling Rights
color
Colors and Color-Indexed Containers
fen
FEN parsing
file
Files
game
Game
halfmoveclock
Half-Move Clock
hash
Zobrist Hashing
history
Position History
magic
mve
Moves
outcome
Game Outcomes
piece
Pieces
ply
Plies
position
Position
rank
Ranks
role
Chess Piece Roles
side
Castling Side
square
Squares
uci
UCI Move Notation
unmoved_rooks
Unmoved Rooks