summaryrefslogtreecommitdiff
path: root/src/eval.c
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2026-10-05 09:01:25 -0700
committerScott Gasch <[email protected]>2026-10-05 09:01:25 -0700
commit64b5d3307a7a95975f7f8c0248f3f1febedd8617 (patch)
tree993fffd62a68bec962261caf033a8f05c6370ea9 /src/eval.c
parentbbdf1bda8f410df6aa9be0a38e71b7db04982198 (diff)
Continue dynamic move-ordering/LMR session: SPRT-validated at 1770+ games
Gate match vs head (st4.0) shows LLR=+2.89 approaching the H1=+2.94 bound, candidate score 0.5324 (LOWER95=0.5092, ELO=+22.6+/-16.2), candidate depth/ebf both improved (13.98 vs 13.61 avg depth, ebf 3.324 vs 3.464) with comparable nps -- consistent with real search-efficiency gains rather than noise. match_play.py gets additional instrumentation to report these stats; search.c/searchsup.c/generate.c/chess.h/eval.c carry the underlying move-ordering/LMR changes from this session's line of work. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c53
1 files changed, 47 insertions, 6 deletions
diff --git a/src/eval.c b/src/eval.c
index 9e50f0a..ae12f0a 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -683,9 +683,9 @@ static ULONG KING_INITIAL_COUNTER_BY_LOCATION[2][128] =
static SCORE KING_EVAL_INITIAL_LOCATION[2][128] =
{
{
- 1, 0, 0, 0, 1, 0, 0, 1, 0,0,0,0,0,0,0,0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,0,0,0,0,0,0,0,
- 3, 3, 3, 3, 3, 3, 3, 3, 0,0,0,0,0,0,0,0,
+ 2, 0, 0, 0, 1, 0, 0, 2, 0,0,0,0,0,0,0,0,
+ 3, 1, 1, 1, 1, 1, 1, 3, 0,0,0,0,0,0,0,0,
+ 4, 3, 3, 3, 3, 3, 3, 4, 0,0,0,0,0,0,0,0,
4, 4, 4, 4, 4, 4, 4, 4, 0,0,0,0,0,0,0,0,
// -------------------------------------------------------------------
4, 4, 4, 4, 4, 4, 4, 4, 0,0,0,0,0,0,0,0,
@@ -700,9 +700,9 @@ static SCORE KING_EVAL_INITIAL_LOCATION[2][128] =
4, 4, 4, 4, 4, 4, 4, 4, 0,0,0,0,0,0,0,0,
// -------------------------------------------------------------------
4, 4, 4, 4, 4, 4, 4, 4, 0,0,0,0,0,0,0,0,
- 3, 3, 3, 3, 3, 3, 3, 3, 0,0,0,0,0,0,0,0,
- 1, 1, 1, 1, 1, 1, 1, 1, 0,0,0,0,0,0,0,0,
- 1, 0, 0, 0, 1, 0, 0, 1, 0,0,0,0,0,0,0,0
+ 4, 3, 3, 3, 3, 3, 3, 4, 0,0,0,0,0,0,0,0,
+ 3, 1, 1, 1, 1, 1, 1, 3, 0,0,0,0,0,0,0,0,
+ 2, 0, 0, 0, 1, 0, 0, 2, 0,0,0,0,0,0,0,0
}
};
@@ -2663,6 +2663,28 @@ Return value:
{
+0, -21, -16, -5, 0, 0, 0, 0
};
+ // 2026-10-04: NEW -- own-side shield-pawn bonus, the mirror image
+ // of KingStormingPawnDefects above (same DISTANCE-indexed shape,
+ // opposite color of pawn, opposite sign). Addresses a real gap:
+ // nothing in _EvalKing previously rewarded keeping a shield pawn
+ // (f2/g2/h2-shaped) on its home square, or penalized pushing it
+ // away -- KingFileDefects only checks whether *a* pawn of either
+ // color still exists somewhere on the file at all, which stays
+ // satisfied even after an unforced push (g2-g3 doesn't change
+ // uCountPerFile), and the front-flight-penalty below is a generic
+ // "empty+unattacked gap" term with no notion that this square
+ // specifically used to be a shield pawn's. Observed in practice:
+ // the engine pushes its own king-shield pawns with no offsetting
+ // cost from this function, then gets punished by the opponent
+ // for the resulting weakened cover. Starting magnitude (+6 at
+ // distance 1, i.e. still right in front of the king) is a guess,
+ // not yet self-play validated -- same disclaimer as every other
+ // freshly-added term in this function's history; expect it to
+ // move once tested.
+ static SCORE KingShieldPawnBonus[8] =
+ {
+ +0, +6, +3, +1, 0, 0, 0, 0
+ };
static SCORE KingFileDefects[3] =
{
-10, -5, 0
@@ -2708,6 +2730,25 @@ Return value:
ASSERT(IS_ON_BOARD(cSquare));
iScore += KingStormingPawnDefects[DISTANCE(cSquare, c)];
}
+
+ // Shield-pawn bonus -- same file, but OUR OWN pawn, nearest
+ // one to the king if doubled (same directional scan as the
+ // enemy-storming-pawn lookup above, just over bbPawns[uColor]
+ // instead of bbPawns[ufColor]).
+ bb = pos->bbPawns[uColor] & BBFILE[u - 1];
+ if (bb)
+ {
+ if (uColor == WHITE)
+ {
+ cSquare = CoorFromBitBoardRank1ToRank8(&bb);
+ }
+ else
+ {
+ cSquare = CoorFromBitBoardRank8ToRank1(&bb);
+ }
+ ASSERT(IS_ON_BOARD(cSquare));
+ iScore += KingShieldPawnBonus[DISTANCE(cSquare, c)];
+ }
}
return iScore;
}