Iterative Deepening, PVS & Aspiration Windows
Depth-by-depth Principal Variation Search with narrow ±3 cp initial aspiration windows and gradual one-sided widening on fail-low/fail-high.
Why does BalouChess do this?
Rather than jumping blindly straight to a high depth, BalouChess searches depth 1, depth 2, depth 3, and so on. Each completed iteration seeds the next iteration with a strong principal variation and guarantees a valid best move whenever the clock expires.
Principal Variation Search (PVS) searches the first candidate move with a full [alpha, beta] window and tests every remaining move with a zero-width scout window [alpha, alpha + 1] to prove cheaply that it is worse, re-searching only when a surprise improvement breaks through. At the root, tight ±3 centipawn aspiration windows around the previous score prune even more of the tree.
[X-RAY CARD 03 // PVS & ASPIRATION WINDOW SIMULATOR]
Step-by-Step Aspiration Widening & Scout Pruning vs. Minimax
Deterministic model tree: depth 4, branching 5 (781 Minimax nodes, cap ±108 cp)
| Pass | Window [alpha, beta] | Returned | Outcome | Nodes (Scout) |
|---|---|---|---|---|
| ▶ #1 | [+17 cp, +23 cp] | +22 cp | EXACT HIT | 93 (8 scout) |
Data Layout, Invariants & Common Pitfalls
Memory & State Layout
Negamax iterative loop up to MAX_PLY = 128 plies (engine, SPEC 003/R21). Depth 1 always completes unconditionally (engine, SPEC 003/R6). Subsequent iterations open an aspiration window centered on the previous exact score (±3 cp baseline, doubling up to full bounds upon fail-low or fail-high) while maintaining exact PV lines and deterministic node-interval stop checks.
Formal Invariants
- Minimax oracle equivalence in verification mode (engine, SPEC 003/R2): with reductions, pruning, and tables disabled via the central parameter table, PVS produces the exact same root score at every depth as a pure recursive minimax reference.
- Guaranteed legal root fallback on interruption (engine, SPEC 003/R6): if a time or stop signal aborts an iteration mid-search, BalouChess selects the highest exact/lower-bound move proved so far in the partial iteration, or else the completed best move from the previous iteration.
Typical Pitfalls & Edge Cases
- Symmetric window explosion on tactical swings: widening both alpha and beta to infinity on the first aspiration fail discards valuable cutoffs; BalouChess widens progressively in the direction of the fail while preserving the opposite bound.
- Non-deterministic clock polling inside bench: checking wall-clock time on every node makes fixed-depth node counts drift; BalouChess polls stop/clock strictly every fixed node interval from the parameter table (engine, SPEC 003/R5, R7).