summaryrefslogtreecommitdiff
path: root/src/chess.h
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2026-08-26 11:50:25 -0700
committerScott Gasch <[email protected]>2026-08-26 11:50:25 -0700
commit7857096f39e16619a42ee85b4aa593abd846b74a (patch)
treece697561b7e6c0978f53323256c0ab9038662e3e /src/chess.h
parent01f5b71fd484801f7b06df3bfb0156f5bb69fef7 (diff)
Replace ctx->uPositional with a data-calibrated Eval() return value.
uPositional was a per-thread EWMA of abs(material - true score) used to size lazy-eval and futility margins. It was history-derived (reflecting whatever recent, unrelated positions looked like) rather than derived from the position actually being margined, and its update/consumption was tangled with EVAL_HASH (now disabled). Eval() now takes an optional SCORE *piPositional out-param and fills it in on every return path: exact (abs(material-delta)) on a full eval, or an estimate from a new EstimatePositionalScore() on a lazy exit. EstimatePositionalScore()'s two terms (king-safety-defect-bucketed, and a flat residual for mobility/passers/everything else) are calibrated from ~1.6M measured full-eval samples (p90 of the actual swing), not guessed -- an initial guessed version measurably regressed ECM solve rate (630 vs a 650 baseline at sn=4M); the recalibrated version is back at parity (649/879). search.c's qsearch futility now reads the value Eval() just computed instead of the stale/shared ctx field. Also removes QSearchInDangerNoStandPat and SideCanStandPat, dead since the danger-hash check that fed them was already commented out (e08387a) -- they depended on the same enprise/ trapped-piece data this conversation is about to move off of g_PositionHash entirely. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Diffstat (limited to 'src/chess.h')
-rwxr-xr-xsrc/chess.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/chess.h b/src/chess.h
index fe5cd2b..d6d4fa4 100755
--- a/src/chess.h
+++ b/src/chess.h
@@ -2565,9 +2565,6 @@ GetEnpriseCount(POSITION *pos, ULONG uSide);
COOR
GetTrappedPiece(POSITION *pos, ULONG uSide);
-FLAG
-SideCanStandPat(POSITION *pos, ULONG uSide);
-
ULONG
ValueOfMaterialInTroubleDespiteMove(POSITION *pos, ULONG uSide);
@@ -2593,6 +2590,9 @@ PawnHashLookup(SEARCHER_THREAD_CONTEXT *ctx);
//
#define LAZY_EVAL
#define LAZE_EVAL_BASE_SCORE 10
+#define LAZY_EVAL_BASE_MARGIN (75) // cheap material-only lazy exit margin;
+ // widened by EstimatePositionalScore
+ // if this isn't enough on its own
extern const int g_iAhead[2];
extern const int g_iBehind[2];
@@ -2614,7 +2614,7 @@ ReadEvalDNA(char *szFilename);
SCORE
-Eval(SEARCHER_THREAD_CONTEXT *, SCORE, SCORE);
+Eval(SEARCHER_THREAD_CONTEXT *, SCORE, SCORE, SCORE *);
FLAG
EvalPasserRaces(POSITION *,