MCPcopy Index your code
hub / github.com/ParthPant/chess-rs

github.com/ParthPant/chess-rs @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
236 symbols 537 edges 24 files 10 documented · 4%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

About The Project

chess-rs is a Chess Engine written from scratch in Rust that runs natively and on web!

Live Demo: https://parthpant.github.io/chess-rs/

screenshot

Features

  • [x] Move Generation using BitBoards (<8s perft results at depth 6 for starting position)
  • [x] Supports all moves including en-passant, pawn promotion and castling
  • [x] GUI gameplay
  • [x] Perft Runner
  • [x] Egui Integration
  • [x] Board Evaluation (Matrial and Positional)
  • [x] AI (NegaMax with Quiescence Search)
  • [x] Move Ordering (MVV-LVA, Killer & History Heuristics)
  • [x] Zobrist Hashing
  • [x] Transposition Tables
  • [x] Incremental Search Deepening
  • [ ] Opening Book

Getting Started

Prerequisites

Rust

You will require the rust toolchain to be installed on your system.

Follow: Rust Website

Note: If you only want to run natively you are good to go. To build for WASM you will also need to install the following.

Web Target

rustup target add wasm32-unknown-unknown

Trunk

cargo install --locked trunk

Build from source

Simply clone the Git repository and build using the cargo build system

git clone https://github.com/ParthPant/chess-rs.git
cd chess-rs
cargo build

Usage

# You can either start the Chess Engine with
cargo run

# Or you can run in the web browser with
trunk serve

# Or you can run perft analysis
cargo run -p chrs-perft -- 5 "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"

License

Distributed under the MIT License. See LICENSE.txt for more information.

Contact

Parth Pant - @PantParth - parthpant4@gmail.com

Project Link: https://github.com/ParthPant/chess-rs.git

Extension points exported contracts — how you extend this code

AI (Interface)
(no doc) [1 implementers]
chrs-lib/src/ai/mod.rs

Core symbols most depended-on inside this repo

move_piece
called by 22
chrs-lib/src/data/mod.rs
get_color
called by 22
chrs-lib/src/data/piece.rs
push
called by 18
chrs-lib/src/data/moves.rs
get_active_color
called by 16
chrs-lib/src/data/mod.rs
to_string
called by 14
chrs-lib/src/data/mod.rs
get_piece_occupancy
called by 14
chrs-lib/src/data/mod.rs
non_zero
called by 12
chrs-lib/src/data/bitboard.rs
get_at_sq
called by 11
chrs-lib/src/data/mod.rs

Shape

Method 177
Function 26
Class 25
Enum 7
Interface 1

Languages

Rust100%

Modules by API surface

chrs-lib/src/data/mod.rs67 symbols
chrs-lib/src/data/moves.rs25 symbols
chrs-lib/src/data/bitboard.rs20 symbols
chrs/src/board/mod.rs19 symbols
chrs-lib/src/generator/mod.rs17 symbols
chrs/src/board/events.rs14 symbols
chrs-lib/src/generator/tables.rs12 symbols
chrs-lib/src/ai/negamax.rs8 symbols
chrs/src/ui/mod.rs7 symbols
chrs-lib/src/ai/eval.rs7 symbols
chrs-lib/src/data/fen.rs6 symbols
chrs-lib/src/zobrist/mod.rs5 symbols

For agents

$ claude mcp add chess-rs \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page