summaryrefslogtreecommitdiff
path: root/src/searchsup.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/searchsup.c')
-rw-r--r--src/searchsup.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/searchsup.c b/src/searchsup.c
index 37eca66..9a2cc50 100644
--- a/src/searchsup.c
+++ b/src/searchsup.c
@@ -270,6 +270,57 @@ ComputeMoveScore(IN SEARCHER_THREAD_CONTEXT *ctx,
}
+SCORE
+GetCheckSee(IN SEARCHER_THREAD_CONTEXT *ctx,
+ IN MOVE mv,
+ IN ULONG uMoveNum)
+/**
+
+Routine description:
+
+ SEE for a checking move, used by ComputeMoveExtension's callers
+ (Search, HelpSearch, and eventually QSearch) to decide how much to
+ extend/reduce a check. Must be computed on the PRE-move position --
+ see.c's exchange walk needs the piece still sitting on cFrom.
+
+ Move generation/scoring (_ScoreAllMoves, _ScoreAllEscapes in
+ generate.c) already runs a real SEE on this same (pos, mv) pair
+ whenever it scores an ambiguous capture or promotion, and stashes
+ the sign in the move's MVF_SEE_KNOWN/MVF_SEE_NONNEGATIVE flags.
+ Reuse that instead of walking the exchange (GetAttacks()) again.
+ Only the sign matters to any caller of ComputeMoveExtension, so the
+ cached value is coarsened to 0/-1.
+
+Parameters:
+
+ SEARCHER_THREAD_CONTEXT *ctx : searcher thread context
+ MOVE mv : the checking move
+ ULONG uMoveNum : mv's index in ctx->sMoveStack.mvf[], or (ULONG)-1
+ if mv did not come from the move stack (e.g. the hash move)
+
+Return value:
+
+ SCORE
+
+**/
+{
+ BITV bvFlags;
+
+ ASSERT(IS_CHECKING_MOVE(mv));
+ if (uMoveNum != (ULONG)-1)
+ {
+ ASSERT(uMoveNum < MAX_MOVE_STACK);
+ ASSERT(IS_SAME_MOVE(mv, ctx->sMoveStack.mvf[uMoveNum].mv));
+ bvFlags = ctx->sMoveStack.mvf[uMoveNum].bvFlags;
+ if (bvFlags & MVF_SEE_KNOWN)
+ {
+ return((bvFlags & MVF_SEE_NONNEGATIVE) ? 0 : -1);
+ }
+ }
+ return(SEE(&ctx->sPosition, mv));
+}
+
+
void
ComputeMoveExtension(IN SEARCHER_THREAD_CONTEXT *ctx,
IN SCORE iAlpha,