From da1b0e61e1ae366f3ec8c4ecc2bd771e9244476a Mon Sep 17 00:00:00 2001 From: rektdie Date: Sun, 15 Nov 2026 15:30:29 +0100 Subject: [PATCH] feat: SEE penalty for quiet moves that hang the piece The policy only penalised a quiet move when an enemy pawn attacked the target square. A knight stepping in front of a bishop or a pawn pushed into an undefended capture got no penalty. Now any quiet move whose static exchange on the target square loses material (SEE < 0) loses 0.004 x the moving piece's value from its logit, the same penalty the pawn threat gave. Every move to a pawn-attacked square fails this SEE, so the old case is covered; the pawn-threat penalty stays for captures only, as before. Example (Italian, white to move): b4 (hangs to Bf8) and g4 (to Nf6) drop from about 3.4% to 2.4%, Bd5 (Nxd5 exd5 loses the exchange of a bishop for a knight) to 1.0%; castling and developing moves stay on top. Bench is deterministic. Bench: 549158 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 2fa45a3..31f0594 100644 --- a/src/eval.cpp +++ b/src/eval.cpp @@ -237,9 +237,12 @@ void policy(const Position& pos, const MoveList& moves, float temperature, const s += 0.01f * float(mg_pst[type][relative_square(us, to)] - mg_pst[type][relative_square(us, from)]); if (type != PAWN && type != KING) { - if (pawn_threats & bb(to)) s -= 0.004f * SEE_VALUE[type]; + if (m.is_capture() && (pawn_threats & bb(to))) s -= 0.004f * SEE_VALUE[type]; if (pawn_threats & bb(from)) s += 0.003f * SEE_VALUE[type]; } + // A quiet move that puts the piece where the exchange loses it (to a + // pawn, or to any attacker it is not defended well enough against). + if (!m.is_capture() && !m.is_promotion() && !see_ge(pos, m, 0)) s -= 0.004f * SEE_VALUE[type]; if (check_squares[m.is_promotion() ? m.promo_type() : type] & bb(to)) s += 0.5f; if (bias) s += bias[i];