From bc28ff15bd51100329a983c544bc06c773ff0c76 Mon Sep 17 00:00:00 2001 From: mstembera <5421953+mstembera@users.noreply.github.com> Date: Thu, 26 Feb 2026 14:25:41 -0800 Subject: [PATCH] Simplify threat by lesser STC https://tests.stockfishchess.org/tests/view/699da988eaae015cd278ede4 LLR: 2.94 (-2.94,2.94) <-1.75,0.25> Total: 141184 W: 36647 L: 36541 D: 67996 Ptnml(0-2): 511, 16620, 36237, 16700, 524 LTC https://tests.stockfishchess.org/tests/view/699f4bee2be03365d5073c71 LLR: 2.95 (-2.94,2.94) <-1.75,0.25> Total: 99852 W: 25463 L: 25322 D: 49067 Ptnml(0-2): 47, 10997, 27721, 11090, 71 Removes a constant and a branch(for the price of a subtract) and treats the from and to squares symmetrically. closes https://github.com/official-stockfish/Stockfish/pull/6637 bench: 2460547 --- src/movepick.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/movepick.cpp b/src/movepick.cpp index 415d252f3..e4a610afe 100644 --- a/src/movepick.cpp +++ b/src/movepick.cpp @@ -171,7 +171,7 @@ ExtMove* MovePicker::score(MoveList& ml) { // penalty for moving to a square threatened by a lesser piece // or bonus for escaping an attack by a lesser piece. - int v = threatByLesser[pt] & to ? -19 : 20 * bool(threatByLesser[pt] & from); + int v = 20 * (bool(threatByLesser[pt] & from) - bool(threatByLesser[pt] & to)); m.value += PieceValue[pt] * v;