From a8806adb87bac158353f851a9ad564941affd153 Mon Sep 17 00:00:00 2001 From: Scott Gasch Date: Thu, 3 Sep 2026 17:10:46 -0700 Subject: Fix draw-score bug in hash-hit path; centralize as g_iDrawScore[2] Search()'s Dieter-Brusser hash-hit-leads-to-draw check only verified that a score of 0 would clear the same alpha/beta bound as the stored iScore -- it didn't establish that iScore itself was accurate. Since playing the hash move actually produces a draw, propagate the draw score upward instead of the stale score computed along a different, non-repeating path. While fixing this, centralized every other place that returned a literal 0 for a draw (search.c's stalemate leaf, searchsup.c's QSearch draw leaf, probe.c's EGTB draw case, which had a dead `// g_iDrawValue[...]` comment suggesting this was intended all along) into a single g_iDrawScore[2] global in draw.c, declared in chess.h. It's indexed by side to move rather than a scalar so a future contempt-factor tweak can bias the draw score per color without touching every call site again; both entries are currently 0, so behavior is unchanged except for the hash-hit bugfix above. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_012e2SaEaQ27JJq1D3wCqryr --- src/draw.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/draw.c') diff --git a/src/draw.c b/src/draw.c index 75d1cd4..7b2b1d5 100755 --- a/src/draw.c +++ b/src/draw.c @@ -22,6 +22,8 @@ Revision History: #include "chess.h" +SCORE g_iDrawScore[2] = {0, 0}; + FLAG IsDraw(SEARCHER_THREAD_CONTEXT *ctx) { -- cgit v1.3