feat: PVS, aspiration windows, richer Lazy SMP, tapered eval, pondering, Polyglot book - #10
Merged
Merged
Conversation
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Replace the LMR-only null-window logic with full principal variation search: the first move at each node keeps a full window at full depth, later moves are scouted with a null window (and an LMR reduction for late quiets) and only re-searched at full depth / full window when the scout beats alpha. Add a triangular PV table to the searcher so the search reports the actual principal variation, not just the best move. SearchResult gains PV. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
From depth 5, each iterative-deepening iteration first searches a narrow window centred on the previous iteration's score. searchRoot now takes an explicit [alpha, beta] and reports a fail-soft score; searchDepth wraps it, doubling the delta on whichever side fails until the score lands inside the window or it opens fully. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- TT entries carry a 6-bit generation; NewSearch() bumps it and store() treats older-generation entries as free space, so each search reclaims the previous search's table instead of being blocked by its deeper entries. Search() calls NewSearch() once per invocation. - Lazy-SMP helpers skew their root move order (each scouts a different alternative to the hash move first) and use a wider, asymmetric aspiration window so they diverge onto different parts of the tree. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Replace the single piece-square table set with the PeSTO middlegame/endgame tables and material values, interpolated by game phase. Layer on positional terms, each accumulated as an (mg, eg) pair and folded into the taper: - passed pawns, bonus scaled by rank (endgame-weighted) - piece mobility for knights/bishops/rooks/queens - king safety: attacker weight in the king ring + a missing-pawn-shield penalty (middlegame only) - a small tempo bonus for the side to move A colour-mirror symmetry test guards the whole evaluation. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
engine.Search grows Stop / Ponder / PonderHit / Info fields: it runs on a copy of the board, streams each completed iteration through the Info callback, and honours an external abort flag. Pondering ignores the clock until PonderHit is observed, then arms the budget from that moment. The UCI layer runs the search on a goroutine. 'go' returns immediately; a mutex serialises stdout; 'stop' aborts; 'ponderhit' converts a ponder search onto its budget; 'go ponder' holds the bestmove until ponderhit or stop. bestmove now carries a 'ponder' move from the PV. Added winc/binc to the time budget and the Ponder option. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Hand-rolled Polyglot support (no new dependency): PolyglotKey computes the book's Zobrist key (validated against the format's canonical key vectors), and OpenBook / Book.Probe read a .bin file and return the highest-weighted legal move for a position, translating the Polyglot castling and promotion move encoding. UCI gains OwnBook and BookFile options; when a book move is available the 'go' handler emits it immediately and skips the search (never while pondering). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Move the delivered backlog items into the Implemented sections of design.md, architecture.md and engine-strength.md; refresh the README feature list, roadmap and UCI options table; note the pre-change performance numbers; add ADR 0003 recording why Syzygy tablebases are deferred. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Extract go-argument parsing into parseGoArgs to bring handleGo under the cyclomatic-complexity limit; drop two nolint:gosec directives gosec does not need on provably-bounded square conversions. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Drop the 5s deadline (both searches are depth-bounded, so they always finish) and lower the fixed depth from 6 to 5. On a -race CI runner the depth-6 search was exceeding the deadline, leaving the full-window baseline with no result to compare against.
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Works through the
docs/design.mdsearch + evaluation backlog on one branch,one commit per feature group.
Search
6e3f75d) — full window for the first move ateach node, null-window scout + re-search for the rest, LMR folded in as an
extra reduction on the scout. Adds a triangular PV table, so
SearchResultand the
infoline now carry the real principal variation.6c08c1c) — from depth 5 each iteration starts insidea ±25 cp window around the previous score, doubling the failing side.
68ee9a2) — a 6-bit TT generation ages out the previoussearch's entries; helper workers skew their root move order and use a wider,
asymmetric aspiration window.
Evaluation (
160a0ea)(mg, eg)pair folded into the taper: passed pawns,mobility (N/B/R/Q), king safety (attacker weight in the king ring + missing
pawn shield), tempo.
Pondering (
5d1bb51)engine.SearchgainsStop/Ponder/PonderHit/Info; it runs on aboard copy and streams each iteration through the callback.
stopaborts immediately,go ponder+ponderhitwork,bestmovecarriesa
pondermove, andwinc/bincfeed the time budget. NewPonderoption.Opening book (
52d72bd)PolyglotKey(validatedagainst the format's canonical key vectors),
OpenBook,Book.Probe.OwnBook/BookFileoptions; a book hit is played with no search.Deferred
Syzygy tablebases — no mature pure-Go prober and the build is strictly
CGO_ENABLED=0. Rationale indocs/adr/0003-defer-syzygy-tablebases.md.Verification
go test -race ./...green; new tests for PV, aspiration parity, TT ageing,eval symmetry, async
stop/ponderhit, and the Polyglot key vectors.go mod tidyclean (no new modules).info … pv …,stop,ponder/ponderhit, andan instant book move all confirmed.
🤖 Generated with Claude Code