summaryrefslogtreecommitdiff
path: root/src/search.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/search.c')
-rwxr-xr-xsrc/search.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/search.c b/src/search.c
index 6c8a945..e0339cf 100755
--- a/src/search.c
+++ b/src/search.c
@@ -943,8 +943,9 @@ QSearchFromCheckNoStandPat(IN SEARCHER_THREAD_CONTEXT *ctx,
uMoveCount = MOVE_COUNT(ctx, ctx->uPly);
if (uMoveCount > 0)
{
- // Consider extending the number of qsearch plies for our opponent
- // if this looks good.
+ // Consider extending the number of qsearch check-generating
+ // plies for our opponent if this looks good -- we have not
+ // yet been able to stand pat and they might mate us.
if ((pf->uQsearchDepth < pf->uQsearchCheckDepth) &&
(pf->uQsearchDepth < g_uIterateDepth / 4) &&
(pf->fCouldStandPat[pos->uToMove] == FALSE) &&
@@ -1144,11 +1145,17 @@ QSearch(IN SEARCHER_THREAD_CONTEXT *ctx,
// If that Eval (above) was full (i.e. not lazy) it may have set
// en prise and trapped piece indicators. Likewise, other nodes
// at this depth may have set en prise piece hints. If these are
- // set and valid, it means this is not a "quiet" position. If the
- // side on the move has not been able to stand pat yet, don't let
- // them now -- force them to play a move and recurse.
- if (0 != ValueOfMaterialInTroubleDespiteMove(ctx, pos->uToMove) &&
- FALSE == ctx->sSearchFlags.fCouldStandPat[pos->uToMove])
+ // set and valid, it means this is not a "quiet" position -- don't
+ // let this side stand pat, force them to play a move and recurse.
+ // This is deliberately independent of fCouldStandPat: whether an
+ // ancestor node in this qsearch line had a moment of safety says
+ // nothing about whether *this* node's material danger is real --
+ // a hanging piece doesn't stop hanging because the position was
+ // quiet three plies ago. fCouldStandPat's job is different (see
+ // its other uses: deciding whether a *whole line* looks forcing
+ // enough to justify extra qsearch depth/breadth), not gating
+ // per-node stand-pat correctness.
+ if (0 != ValueOfMaterialInTroubleDespiteMove(ctx, pos->uToMove))
{
iBestScore = iAlpha;
}