summaryrefslogtreecommitdiff
path: root/src/searchsup.c
diff options
context:
space:
mode:
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) &&