A UCI-compliant chess engine written in C using bitboards for efficient move generation and evaluation.
- UCI Protocol: Full UCI (Universal Chess Interface) compliance
- Bitboard Representation: Efficient 64-bit board representation
- Move Generation: Legal move generation for all piece types
- Advanced Search: Alpha-beta search with quiescence, null move pruning, futility pruning, and razor pruning
- Evaluation: Material and positional evaluation with piece-square tables
- Move Ordering: MVV-LVA move ordering with history heuristic
- Transposition Table: 1M entry hash table for position caching
- Opening Book: Human-editable opening book support
- Time Management: Basic time control and move time management
- Iterative Deepening: Progressive depth search with time constraints
- GCC compiler (version 4.9 or later)
- Make (for Unix/Linux/macOS)
- Windows Command Prompt or PowerShell (for Windows)
- Git (installation)
git clone https://github.com/reposketched/ryska.git # or download the code directly
# Using the provided batch file
./build.bat
# Or manually with GCC
gcc -Wall -Wextra -O2 -std=c99 -c src/*.c -o obj/*.o
gcc obj/*.o -o chess_engine.exe# Clone the repository
git clone https://github.com/reposketched/ryska.git
cd chess-engine
# Build using Make
make
# Or manually with GCC
mkdir -p obj
gcc -Wall -Wextra -O2 -std=c99 -c src/*.c -o obj/*.o
gcc obj/*.o -o chess_engineThe build process creates:
chess_engine(Unix/Linux/macOS) orchess_engine.exe(Windows)obj/directory with compiled object filesbook.txtopening book file (if missing)
# Start the engine
./chess_engine # Unix/Linux/macOS
chess_engine.exe # WindowsThe engine will start and wait for UCI commands on stdin.
You can use the engine with any UCI-compatible chess GUI:
- Arena - Free chess GUI
- Cutechess - Cross-platform chess GUI
- Fritz - Commercial chess software
- Chessbase - Professional chess database
- Lichess - Online chess platform (via UCI engine)
# Test basic UCI commands
echo "uci" | ./chess_engine
echo "isready" | ./chess_engine
echo "position startpos" | ./chess_engine
echo "go depth 4" | ./chess_engineuci- Engine identificationisready- Engine ready statusucinewgame- Start new gameposition [fen <fenstring> | startpos] moves <move1> ... <movei>- Set positiongo [depth <x>] [movetime <x>] [wtime <x>] [btime <x>] [winc <x>] [binc <x>]- Start searchstop- Stop searchquit- Quit engine
- Bitboards (
bitboard.h/c): 64-bit board representation and operations - Board (
board.h/c): Board state management and FEN parsing - Move Generation (
movegen.h/c): Legal move generation for all pieces - Evaluation (
evaluation.h/c): Position evaluation with piece-square tables and mobility - Search (
search.h/c): Advanced search with multiple pruning techniques - Transposition Table (
transposition.h/c): Position caching for improved performance - Opening Book (
book.h/c): Human-editable opening move database - UCI Interface (
uci.h/c): UCI protocol implementation
- Null Move Pruning: Reduces search depth for null moves
- Futility Pruning: Prunes moves unlikely to improve alpha
- Razor Pruning: Aggressive pruning for deep searches
- History Heuristic: Tracks move success for better ordering
- Iterative Deepening: Progressive depth search with time management
- Piece-Square Tables: Positional bonuses for piece placement
- Mobility Evaluation: Considers piece mobility in evaluation
- Maximum Depth: 64 plies
- Transposition Table: 1M entries
- Null Move Reduction: 2 plies
- Futility Margin: 150 centipawns
- Razor Margin: 400 centipawns
The engine is optimized for:
- Speed: Efficient bitboard operations and move generation
- Memory: Compact data structures and efficient caching
- Accuracy: Legal move generation and proper evaluation
Current limitations include:
- No parallel search (single-threaded)
- Basic time management
- No endgame tablebases
- Simplified evaluation compared to commercial engines
Planned enhancements:
- Multi-threading support
- Advanced time management
- Endgame tablebase integration
- Neural network evaluation
- Improved opening book format
- Better move ordering heuristics
chess-engine/
├── src/ # Source code
├── obj/ # Compiled objects
├── build.bat # Windows build script
├── Makefile # Unix build configuration
├── book.txt # Opening book
└── README.md # This file
-Wall -Wextra: Enable all warnings-O2: Optimize for speed-std=c99: Use C99 standard
This project is open source and available under the MIT License.