summaryrefslogtreecommitdiff
path: root/src/searchsup.c
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2026-08-27 07:41:41 -0700
committerScott Gasch <[email protected]>2026-08-27 07:42:25 -0700
commit4ce6a76b0946e4ba943d29c506c9e2fb00601efd (patch)
treeb072c6fe2a5e8527a28f5c821d76591e93fa86f6 /src/searchsup.c
parent7857096f39e16619a42ee85b4aa593abd846b74a (diff)
Baseline: uPositional data-calibrated fix, enprise/trapped hints, EBF/beta-cutoff/counter-move stats, script.c FPE fix.
No LMR, no counter-move-driven move ordering (both explored separately, kept out for now -- counter-move measured worse, ~655->647 solved on ecm879 @ sn=4M with a leaner tree beforehand). Futility pruning restored. Verified: 647/879 solved, EBF 4.609 @ sn=4M; 684/879 solved, EBF 3.995 @ 20s/move, 1cpu, 256m hash (typhoon_baseline.log). The counter-move table is still written and its stats still tracked (dynamic.c) for diagnostic purposes, but generate.c no longer reads it for move ordering, so it has no effect on search behavior in this commit. lmr_testing/ holds the in-flight graded-LMR + counter-move code (not applied here) with notes on what was already tried and measured, so a future session can resume without re-deriving it.
Diffstat (limited to 'src/searchsup.c')
-rw-r--r--src/searchsup.c48
1 files changed, 21 insertions, 27 deletions
diff --git a/src/searchsup.c b/src/searchsup.c
index 0cf52bf..c7ac842 100644
--- a/src/searchsup.c
+++ b/src/searchsup.c
@@ -187,35 +187,28 @@ ThreadUnderTerminatingSplit(IN SEARCHER_THREAD_CONTEXT *ctx)
}
-FLAG
-WeShouldDoHistoryPruning(IN SCORE iRoughEval,
- IN SCORE iAlpha,
- IN SCORE iBeta,
- IN SEARCHER_THREAD_CONTEXT *ctx,
- IN ULONG uRemainingDepth,
- IN ULONG uLegalMoves,
- IN MOVE mv,
- IN ULONG uMoveNum,
- IN INT iExtend)
+INT
+GetLMRReduction(IN SCORE iRoughEval,
+ IN SCORE iAlpha,
+ IN SCORE iBeta,
+ IN SEARCHER_THREAD_CONTEXT *ctx,
+ IN ULONG uRemainingDepth,
+ IN ULONG uLegalMoves,
+ IN MOVE mv,
+ IN ULONG uMoveNum,
+ IN INT iExtend)
/**
Routine description:
- Decide whether or not to do history pruning at this node for the
- given move. Note: this function is called after the move has
- been played on the board.
-
-Parameters:
-
- SEARCHER_THREAD_CONTEXT *ctx,
- ULONG uRemainingDepth,
- ULONG uLegalMoves,
- MOVE mv,
- INT iExtend
+ True pre-LMR/pre-counter-move baseline: original binary history
+ pruning (fixed -ONE_PLY), no graded table, no PV-parent guard, no
+ counter-move exemption. Kept under the GetLMRReduction name so
+ search.c/split.c's call sites need no changes.
Return value:
- FLAG
+ INT : 0 if no reduction, else -ONE_PLY.
**/
{
@@ -226,7 +219,6 @@ Return value:
(iBeta == (iAlpha + 1)) &&
(uLegalMoves > 5) &&
(0 == iExtend) &&
-// (iRoughEval + ComputeMoveScore(ctx, mv, uMoveNum - 1) + 200 < iAlpha) &&
(!IS_ESCAPING_CHECK(mv)) &&
(!IS_CAPTURE_OR_PROMOTION(mv)) &&
(!IS_CHECKING_MOVE(mv)) &&
@@ -238,9 +230,9 @@ Return value:
(GetMoveFailHighPercentage(mv) <= 10))
{
ASSERT(!InCheck(&ctx->sPosition, ctx->sPosition.uToMove));
- return(TRUE);
+ return(-ONE_PLY);
}
- return(FALSE);
+ return(0);
}
@@ -1027,7 +1019,7 @@ WeShouldTryNullmovePruning(SEARCHER_THREAD_CONTEXT *ctx,
ASSERT(u <= 6);
if ((iRoughEval + _iDistAlphaSkipNull[u] <= iAlpha) ||
((iRoughEval + _iDistAlphaSkipNull[u] / 2 <= iAlpha) &&
- (ValueOfMaterialInTroubleAfterNull(pos, pos->uToMove))))
+ (ValueOfMaterialInTroubleAfterNull(ctx, pos->uToMove))))
{
return FALSE;
}
@@ -1125,7 +1117,9 @@ TryNullmovePruning(SEARCHER_THREAD_CONTEXT *ctx,
{
ASSERT(GET_COLOR(mv.pCaptured) == FLIP(pos->uToMove));
ASSERT(mv.pCaptured == pos->rgSquare[mv.cTo].pPiece);
- StoreEnprisePiece(pos, mv.cTo);
+ // Victim belongs to FLIP(pos->uToMove) here, i.e. the
+ // mover at ctx->uPly - 1 (see RecordEnprisePieceAtPly).
+ RecordEnprisePieceAtPly(ctx, ctx->uPly - 1, mv.cTo);
mvRef = ctx->mvNullmoveRefutations[ctx->uPly - 2];
if ((mvRef.uMove) &&
(mvRef.pCaptured == mv.pCaptured) &&