| Crates.io | bitboard_chess_engine |
| lib.rs | bitboard_chess_engine |
| version | 0.1.9 |
| created_at | 2025-11-15 02:39:07.229537+00 |
| updated_at | 2025-11-23 22:55:33.60209+00 |
| description | A chess engine with UCI support |
| homepage | |
| repository | https://github.com/brendandagys/Chess-Engine |
| max_upload_size | |
| id | 1933947 |
| size | 408,762 |
A high-performance chess engine written in Rust with UCI protocol support and a CLI interface.
Add to your Cargo.toml:
[dependencies]
chess-engine = "0.1"
Install the command-line interface:
cargo install chess-engine --bin chess-engine-cli
Install the UCI interface:
cargo install chess-engine --bin chess-engine-uci
Or, install both:
cargo install chess-engine --bins
Play interactively against the engine:
chess-engine-cli
The CLI provides:
Use with UCI-compatible chess GUIs:
chess-engine-uci
Or integrate with tools like cutechess-cli:
cutechess-cli -engine cmd=chess-engine-uci -engine cmd=stockfish
use chess_engine::engine::Engine;
use chess_engine::types::Difficulty;
fn main() {
// Create a new engine instance
let mut engine = Engine::new(
None, // White time (ms)
None, // Black time (ms)
None, // White increment (ms)
None, // Black increment (ms)
Some(5000), // Move time: 5 seconds
None, // Max depth
None, // Max nodes
None, // Opening book path
Some(Difficulty::Medium),
);
// Search for the best move
let result = engine.think(None::<fn(u16, i32, &mut Position)>);
println!("Best move: {:?} -> {:?}",
result.best_move_from,
result.best_move_to
);
println!("Evaluation: {} centipawns", result.evaluation);
println!("Searched {} nodes in {} ms", result.nodes, result.time_ms);
}
# Clone the repository
git clone https://github.com/brendandagys/Chess-Engine.git
cd Chess-Engine
# Build in release mode
cargo build --release
# Binaries will be in target/release/
./target/release/chess-engine-cli
./target/release/chess-engine-uci
The project includes comprehensive test suites:
# Run all tests with proper stack size
make test
# Or directly with cargo
RUST_MIN_STACK=33554432 cargo test --release
Test coverage includes:
src/
├── lib.rs # Library root
├── engine.rs # Main engine logic and search
├── position.rs # Board representation and move generation
├── hash.rs # Transposition table with Zobrist hashing
├── types.rs # Core data structures
├── constants.rs # Game constants and piece values
├── uci.rs # UCI protocol implementation
├── time.rs # Time management
├── polyglot.rs # Opening book support
└── bin/
├── cli.rs # Interactive CLI
└── uci.rs # UCI binary entry point
tests/ # Comprehensive test suite
opening_books/ # Polyglot opening books
The engine supports multiple difficulty settings:
uci - Identify engineisready - Check readinessucinewgame - Start new gameposition [fen <fenstring> | startpos] moves <move1> ... <movei> - Set positiongo [wtime <x> btime <x> winc <x> binc <x> | movetime <x> | depth <x>] - Start searchingstop - Stop searchingquit - Exit engineThis project is dual-licensed under either:
at your option.
Brendan Dagys - brendandagys@gmail.com
https://github.com/brendandagys/Chess-Engine
Contributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.