How the engine is put together, what each technique buys, and the backlog of ideas not yet implemented. For a prioritised list of next steps see tasks.md; for strength and speed numbers see engine-strength.md and performance.md.
Negamax is the search core. It holds four collaborators, each a plain object
with a small interface, injected at construction:
| collaborator | responsibility |
|---|---|
PestoEvaluator |
static evaluation from the side-to-move's view |
MoveOrderer |
orders moves to maximise alpha-beta cut-offs; owns killer / history tables |
TranspositionTable / SharedTT |
Zobrist-keyed cache; same key / probe / store interface, one in-process, one in shared memory |
Clock |
turns go limits into a deadline / node budget and answers should_stop |
lazy_smp.search is the coordinator: it spawns worker processes, each running
its own iterative deepening Negamax against a shared SharedTT, and returns
the best completed result as a SearchResult. __main__.py is the UCI protocol
layer and the only place that prints info / bestmove.
- Negamax - fail-soft
- Alpha-Beta Pruning
- Principal Variation Search - full window on the first move, null-window scout + re-search on the rest
- Null Move Pruning -
R = 2..3, skipped in check / zugzwang / at low depth, with a verification search at high depth - Late Move Reductions - late quiet non-checking moves searched
1..3plies shallower, full-depth re-search on a fail-high - Mate-distance pruning - window clamped to the fastest mate still possible from the node
- Quiescence Search - fail-soft, depth-bounded, check-aware
- Draw detection - threefold repetition and the fifty-move rule scored
0inside the tree (CONTEMPThook for a non-zero draw score) - Transposition Table - Zobrist-keyed, EXACT / LOWER / UPPER bounds, mate scores rebased by ply on store/probe
- Iterative Deepening - per worker, with UCI time management
- Move Ordering - TT move, MVV-LVA captures, promotions, killers, history
- Lazy SMP - workers share a lock-free shared-memory TT
- Opening book (Stockfish-derived Polyglot)
- PeSTO - tapered mid-/end-game piece-square tables, interpolated by game phase, incrementally updated on
EvalBoard.push/pop - Positional terms (
eval_terms) - passed / isolated / doubled pawns, bishop pair, rook on open file, knight outposts, pawn-shield king safety, tempo; recomputed per call with the pawn terms cached on the pawn bitboards
- Static Exchange Evaluation for capture ordering
- Relative History Heuristic
- Aspiration Windows
- Syzygy endgame tablebases
- Stronger king safety (attack-weight on the king zone, not just the pawn shield), mobility, backward pawns, king-distance scaling for passers
- Evaluation / material hash tables; make the new positional terms incremental on
EvalBoard
(NegaScout / PVS is already implemented - see above.)