From 1460f5e81ee04b106609c10691853efaa887fc7d Mon Sep 17 00:00:00 2001 From: rektdie Date: Sun, 15 Nov 2026 15:25:53 +0100 Subject: [PATCH] feat: SEE decides the capture bonus in the policy The +262 Elo of butterfly history showed that the hand-written policy is the main weakness. One clear flaw: every capture got a +1 logit bonus, including ones that just lose the piece (a knight taking a defended pawn, a bishop sacrifice on f7). Now a capture whose static exchange on the square loses material (SEE < 0) gets -1 instead of +1; the victim and attacker terms are unchanged. Example priors (startpos-like middlegame, white to move): Nxe5 with the pawn defended 0.3%, Bxf7+ 1.4%, while winning captures stay on top (Nxe5 against an undefended pawn 10.8%). Bench is deterministic. Bench: 552832 Co-Authored-By: Claude Opus 5.5 --- src/eval.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/eval.cpp b/src/eval.cpp index 40ec99d..2fa45a3 100644 --- a/src/eval.cpp +++ b/src/eval.cpp @@ -227,7 +227,10 @@ void policy(const Position& pos, const MoveList& moves, float temperature, const const int type = piece_type(pos.piece_on(from)); float s = 0.0f; - if (m.is_capture()) s += 1.0f + 0.004f * SEE_VALUE[victim_type(pos, m)] - 0.0015f * SEE_VALUE[type]; + // Captures are tried early, unless the exchange on the square loses material. + if (m.is_capture()) + s += (see_ge(pos, m, 0) ? 1.0f : -1.0f) + 0.004f * SEE_VALUE[victim_type(pos, m)] - + 0.0015f * SEE_VALUE[type]; if (m.is_promotion()) s += m.promo_type() == QUEEN ? 2.5f : -2.5f; if (m.is_castle()) s += 0.8f; -- 2.47.3