Skip to content

Engine: an evaluation's quiet line and piece values (quiet, pieces, searchScore) - #21

Merged
cjus merged 2 commits into
mainfrom
claude/evaluate-pieces
Nov 1, 2026
Merged

cjus merged 2 commits into
mainfrom
claude/evaluate-pieces

Conversation

@cjus

@cjus cjus commented Nov 1, 2026

Copy link
Copy Markdown
Owner

For cjus/chessgui#340 (Engine Mind's "why this move"). Two optional params on engine/evaluate, each behind a capability of its own name, added to the 1.0 draft.

Why

Measured with cb2026 at the end of 30 reported lines (10 positions, MultiPV 3; the data is in cjus/chessgui#340):

  • terms explain an evaluation the search doesn't use. cb2026 searches with an NNUE network, but engine/evaluate breaks down its hand-crafted evaluation. At the lines' ends, that evaluation ordered the three lines as the search did in 0 of 10 positions. The network ordered them right in 5 of 10, and where a line ended quietly, its score usually equalled the search's exactly.
  • A pv can end mid-exchange. In 2 lines of 30, the line stopped where the quiescence search took over, with a piece about to be taken back. Its static evaluation was 250–550 cp from the search's score. So the spec's advice to "evaluate the position at the end of its pv" didn't hold.

What

  • quiet (capability quiet): the node plays out captures, queen promotions and evasions as its search does at a leaf, and evaluates where they stop. quiet in the result lists the moves, which may be none: a capture the side to move needn't make is left alone. With quiet, a side checkmated where the captures stop is {"mate": 0}.
  • pieces (capability pieces): each piece but the kings, with square and value: what it is worth to its own side by the search's evaluation, measured by evaluating the position without it. A network has no terms, but it can be asked this. Stockfish's eval shows the same idea.
  • searchScore, from a node with pieces: the search's own static score, when terms break down another evaluation.
  • §7.6's text, an example whose numbers come from cb2026's node built against this branch, the capability table, and Changes.
  • EvaluateParams::new, EvaluateResult::{quiet, search_score, pieces}, PieceValue and the two capabilities, with tests.
  • Two sessions: evaluate-quiet-pieces (no line to settle at the start, a checkmate settles into mate in 0, and each param asked alone), and evaluate-quiet-pieces-unsupported.

Checked

  • cargo fmt --check, cargo clippy --workspace --all-targets -- -D warnings, cargo test, cargo doc with -D warnings and cargo deny check pass locally.
  • cb2026's node, built against this branch, passes every session that applies to it, the new one included (its PR follows once this merges).

Breaking for struct literals: EvaluateParams { position } needs EvaluateParams::new(position), and an EvaluateResult literal needs the three new fields. cb2026's and Solrac's pin bumps make those changes.

🤖 Generated with Claude Code

cjus and others added 2 commits November 1, 2026 07:06
…earchScore)

engine/evaluate gains two optional params, each behind a capability of its
own name:

- quiet: settle captures first, as the search does at its leaves, and
  evaluate the position where they stop. A search's pv can end in the middle
  of an exchange, so the position it reaches isn't always where its score came
  from (measured with cb2026: 2 lines in 30, off by 250 to 550 cp).
- pieces: what each piece but the kings is worth to the search's evaluation,
  the evaluation less the evaluation without the piece. An engine that
  searches with a neural network has no terms for it; cb2026's terms are its
  hand-crafted evaluation's, which ordered three lines as its search did in
  0 of 10 positions.

With pieces, a node also says the search's own score (searchScore) when terms
break down another evaluation. Two conformance sessions: the fields, and their
refusal by a node without them. For cjus/chessgui#340.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…to make

After 1.e4 d5 White needn't take on d5, and cb2026's quiescence search stands
pat: nothing to settle. After 2.exd5 Black's queen has to take back. The spec
says a capture the side to move needn't make is left alone, and its example,
session and test use the recapture. The example's numbers are cb2026's own
answer, from its node built against this branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cjus
cjus marked this pull request as ready for review November 1, 2026 14:15
@cjus
cjus merged commit 3791c23 into main Nov 1, 2026
2 checks passed
@cjus
cjus deleted the claude/evaluate-pieces branch November 1, 2026 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant