diff options
| author | Scott Gasch <[email protected]> | 2026-08-26 08:26:19 -0700 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2026-08-26 08:26:19 -0700 |
| commit | 01f5b71fd484801f7b06df3bfb0156f5bb69fef7 (patch) | |
| tree | 1fb03c6bd06c69f7a077301b20f000bb154e721c /src/searchsup.c | |
| parent | df0135e11e9ea3dd0acab94fdf437451ef7e522b (diff) | |
Don't [re-]consult the SEE when generator already just did so.
Diffstat (limited to 'src/searchsup.c')
| -rw-r--r-- | src/searchsup.c | 51 |
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, |
