1 Commits
Author SHA1 Message Date
rektdieandclaude 1460f5e81e 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 <noreply@anthropic.com>
2026-11-15 15:25:53 +01:00
+4 -1
View File
@@ -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;