Ply is a high-performance, UCI-compatible chess engine written in C++. It utilizes advanced bitboard techniques and modern search heuristics to achieve a competitive playing strength of approximately 2185 Elo.
- Iterative Deepening: Progressive deepening for better time management and move ordering.
- Negamax with Alpha-Beta Pruning: Optimized minimax search.
- Quiescence Search: Prevents the "horizon effect" by searching tactical captures until stability.
- Null Move Pruning (NMP): Efficiently prunes branches where the opponent has no immediate threats.
- Late Move Pruning (LMP): Aggressively prunes quiet moves at low depths (1-3) after searching the most promising 8-30 moves.
- Late Move Reduction (LMR): Searches quiet, late moves at shallower depths to save time.
- Aspiration Windows: Narrows search bounds around previous scores for faster cutoffs.
- Check Extensions: Searches tactical check positions more deeply.
- Pruning: Includes Futility Pruning, Delta Pruning (in Quiescence), SEE Pruning, and Razoring.
- Draw Detection: Handles three-fold repetition and the 50-move rule correctly.
- Material & PSQT: Base evaluation using material weights and Piece-Square Tables.
- Pawn Structure: Penalties for doubled and isolated pawns; bonuses for passed pawns.
- Rook Activity: Bonuses for rooks on open files, semi-open files, and the 7th rank.
- Bishop Pair: Positional bonus for possessing both bishops.
- King Safety: Dynamic pawn shield evaluation and king zone attack tracking.
- Tapered Eval: Smooth interpolation between middle-game and endgame values.
- Bitboards: Efficient board representation using 64-bit integers.
- Magic Bitboards: High-performance sliding piece move generation (Rooks and Bishops).
- Transposition Table (TT): Stores previously searched positions with Zobrist hashing.
- Opening Book: Supports Polyglot (
.bin) opening books for diverse and strong early play. - Move Ordering: TT moves, Static Exchange Evaluation (SEE), Killer Moves, and History Gravity (with malus).
Ply can be compiled using g++ with high optimization levels.
- A C++17 compatible compiler (e.g., GCC, Clang, or MSVC).
To build the engine, run the following command in the root directory:
g++ -O3 board.cpp evaluate.cpp movegen.cpp polyglot.cpp uci.cpp search.cpp magics.cpp main.cpp -o engine.exePly follows the Universal Chess Interface (UCI) protocol. You can run it directly from the command line or load it into any chess GUI that supports UCI (such as Arena, Cute Chess, or LucasChess).
uci: Identify the engine and list supported options.isready: Sync with the engine.ucinewgame: Prepare the engine for a new game.position startpos moves [moves]: Set the current board position.go depth [n]orgo movetime [ms]: Start searching for the best move.
In testing against established benchmarks (Stockfish 2200), Ply maintains a competitive performance level:
- Estimated Strength: ~2450 Elo
- Nodes Per Second (NPS): ~1.1 - 1.2M (depending on hardware)
This project is licensed under the MIT License - see the LICENSE file for details.
Author: Arnav Tyagi
Date: April 2026