A powerful chess engine implemented in C++, featuring efficient bitboard operations and comprehensive move generation for all pieces.
- Bitboard-based chess board representation
- FEN string parsing and position setup
- Comprehensive move generation for all pieces
- Attack table pre-computation for faster move generation
- Unicode chess piece visualization
- Support for special moves (castling, en passant)
The chess engine uses bitboards (64-bit integers) for efficient board representation:
- Each piece type has its own bitboard
- Additional bitboards for white and black pieces
- Position tracking using bit manipulation operations
- Support for complete chess state including castling rights and en passant squares
The engine implements an efficient method for calculating sliding piece moves (rooks, bishops, queens):
- Pre-computed attack tables for each square
- Efficient bitboard operations (MSB, LSB) for ray tracing
- Separate handling of each movement direction
- Occupancy consideration to handle piece blocking
The engine generates legal moves using:
- Pre-computed attack tables for non-sliding pieces (pawns, knights, kings)
- Dynamic calculation for sliding pieces based on current board occupation
- Special move handling (castling, en passant, promotions)
- Legal move filtering based on check detection
- Clone the repository:
git clone https://github.com/jatingaur18/Chess-Engine.git
- Build the project:
make
Run the chess engine:
./a
or
make run
to build and run
The engine supports:
- FEN string input for position setup
- Move generation visualization
- Unicode piece display
- Performance metrics
main.cpp- Entry point and testing frameworkboard.cpp- Core chess board implementation and move generationutils.h- Utility functions and constantsboard.h- Class declarations and bitboard definitions
- Bitboard Design
- Piece Representation
- Square Indexing
- Board Initialization
- FEN Parsing
- Pawn Moves
- Knight Moves
- King Moves
- Rook, Bishop, Queen Sliding Moves
- Precomputed Attack Tables
- Castling Logic
- En Passant Logic
- Promotion Handling
- Check Detection
- Legal Move Filtering
- Minimax Search
- Alpha-Beta Pruning
- Evaluation Placeholder
- MVV-LVA Ordering
- Killer Move Heuristic
- Transposition Table (Zobrist Hashing)
- Quiescence Search
- Static Exchange Evaluation (SEE)
- Stand Pat Evaluation
- Principal Variation Search (PVS)
- Late Move Reductions (LMR)
- Null Move Pruning
- Aspiration Windows
- Material Evaluation
- Piece-Square Tables
- King Safety Heuristics
- Mobility Evaluation
- Pawn Structure (Isolated, Passed, Doubled)
- Integrate Pretrained NNUE
- Custom NNUE Model Training
- Evaluation Layer Replacement with NNUE
- Endgame Heuristics
- Syzygy Tablebase Support
- Tablebase Probing
- Time Management Logic
- Multi-Threading (SMP Search)
- Move Caching & Reuse
- Benchmarking & Profiling
- Reinforcement Learning Pipeline (Leela Style)
- Hybrid MCTS + AlphaBeta
- Style Customization (Aggressive, Positional, Defensive)