The engine is the core C++ application that plays chess. It implements the Universal Chess Interface (UCI) protocol, runs the search algorithm, and evaluates positions using a natively-compiled Factorized Mixture-of-Experts neural network — or a classical heuristic fallback when no weights are loaded.
The engine is split into three logical subsystems, each documented in detail below:
- Search — The search algorithm and move ordering
- Evaluation — Neural network evaluation and heuristic fallback
- Infrastructure — Transposition table, time control, UCI, tablebases, and opening book
Directory Layout
engine/
├── CMakeLists.txt # Build configuration
├── src/
│ ├── main.cpp # Entry point
│ ├── Types.h # Shared type definitions
│ ├── feature_api.cpp # Feature bridge for native inference
│ ├── search/
│ │ ├── Negamax.h/cpp # Core search algorithm
│ │ ├── MovePicker.h/cpp # Move generation and ordering
│ │ ├── MCTS.h/cpp # Monte Carlo Tree Search (experimental)
│ │ ├── TT.h/cpp # Transposition table
│ │ ├── TimeManager.h # Time allocation
│ │ ├── SearchHeuristics.h # Killer, history, counter-move tables
│ │ ├── ISearch.h # Search interface
│ │ └── TablebaseFallback.h/cpp
│ ├── eval/
│ │ ├── Evaluator.h/cpp # Evaluator dispatcher
│ │ ├── IEvaluator.h # Evaluator interface
│ │ ├── EvalContextMoECache.h/cpp # Native MoE inference
│ │ ├── SimpleEvalContext.h/cpp # Classical piece-square tables
│ │ ├── MoERouting.h # Expert routing logic
│ │ └── WDLConverter.hpp # Centipawn ↔ WDL conversion
│ ├── uci/
│ │ ├── UCI.h/cpp # UCI command loop
│ │ └── UciOptions.h/cpp # Dynamic option parsing
│ ├── book/
│ │ ├── polyglot_book.h/cpp # Polyglot book reader
│ │ └── polyglot_keys.cpp # Zobrist key tables
│ └── tablebases/
│ ├── Tablebase.h/cpp # Syzygy probing API
│ └── tbprobe/ # Fathom probing library