Suppress pruning of futile interpositions in Kyoto Shogi
authorH.G.Muller <hgm@hgm-xboard.(none)>
Wed, 11 Apr 2018 07:32:12 +0000 (09:32 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Thu, 12 Apr 2018 07:14:22 +0000 (09:14 +0200)
In horizon nodes check evasions through drops on unprotected squares were
pruned, based on the idea that the checking slider would simply capture
the piece to renew the check. In games with automatic promotion (such as
Kyoto an micro-Shogi) this capture would alter the piece type, so we cannot
be sure it woul renew the check. The auto-promotion is recognize from
'promoDrops', as these always seem to go together.

dropper.c

index b4d10fa..5d521cf 100644 (file)
--- a/dropper.c
+++ b/dropper.c
@@ -1269,7 +1269,7 @@ Search (int stm, int alpha, int beta, StackFrame *ff, int depth, int reduction,
     if(f.checker == CK_UNKNOWN) CheckTest(stm, ff, &f); // test for check if hash did not supply it
     if(f.checker != CK_NONE) {
        depth++, maxDepth++, reduction = originalReduction = 0 /*, killers[ply][2] = -1*/; // extend check evasions
-       if(earlyGen && f.checkDist && maxDepth <= 1) ipMask = SafeIP(&f);
+       if(earlyGen && f.checkDist && maxDepth <= 1 && !promoDrops) ipMask = SafeIP(&f);
     } else if(depth > LMR) {
        if(depth - reduction < LMR) reduction = depth - LMR; // never reduce to below 'LMR' ply
        depth -= reduction;
@@ -1313,7 +1313,7 @@ Search (int stm, int alpha, int beta, StackFrame *ff, int depth, int reduction,
        if(MoveGen(stm, &m, f.rights)) { // impossible (except for hash collision giving wrong in-check status)
            if(DEBUG) Dump("King capture"); ff->depth = MAXPLY; ff->lim = -INF; moveSP = oldSP; anaSP = oldAna; return INF;
        }
-       if(f.checkDist && maxDepth <= 1) ipMask = SafeIP(&f);
+       if(f.checkDist && maxDepth <= 1 && !promoDrops) ipMask = SafeIP(&f);
     }
     if(hashMove) moveStack[--m.firstMove] = hashMove; // put hash move in front of list (duplicat!)
     if(f.checker != CK_NONE) moveSP = m.drops = m.castlings; // clip off castlings when in check