moveStack[bestNr] = moveStack[curMove]; moveStack[curMove] = bestCapt; // swap it to front
m.unsorted = curMove + 1; // sorted set now includes move
} else {
- if(maxDepth <= 0) { resultDepth = 0; if(bestScore < curEval) bestScore = curEval; break; } // in QS we stop after captures
+ if(maxDepth <= 0) {
+ resultDepth = 0; if(bestScore < anaEval) bestScore = anaEval;
+ if(m.stage) break;
+ moveSP = curMove;
+ if(ff->checker != CK_NONE && depthLimit != MAXPLY && oldLimit == MAXPLY) { // last move before QS was evasion
+ CheckDrops(stm, f.xking); // also do check drops
+ if(moveSP > curMove) { m.stage = 3; m.unsorted = moveSP; curMove--; continue; }
+ }
+ if(depthLimit == MAXPLY || oldLimit != MAXPLY || checkHist[moveNr+ply-1] == CK_NONE) break;
+ if(killer1 && PseudoLegal(stm, killer1)) moveStack[moveSP++] = moveStack[m.late], moveStack[m.late++] = killer1; // try (possibly inherited) killers
+ if(killer2 && PseudoLegal(stm, killer2)) moveStack[moveSP++] = moveStack[m.late], moveStack[m.late++] = killer2;
+ CheckDrops(stm, f.xking);
+ if(curMove >= moveSP) break;
+ m.stage = 3; m.unsorted = moveSP;
+ curMove--;
+ continue;
+ } // in QS we stop after captures
switch(m.stage) { // we reached non-captures
case 0:
if(f.checker == CK_NONE) { // do not use killers when in check