f.pstEval = -ff->newEval;
f.rights = ff->rights | spoiler[ff->toSqr] | spoiler[ff->fromSqr];
m.epSqr = ff->epSqr; // put in m, because MoveGen needs it
-if(PATH)printf("%d:%d Hash Probe %016llx\n",ply,depth,f.hashKey);
+
// hash probe
hashKeyH = f.hashKey >> 32;
entry = hashTable + (f.hashKey + (stm + 9849 + f.rights)*(m.epSqr + 51451) & hashMask);
}
reduction = 0; // checks are not reduced
}
-if(PATH)printf(" Hit, d=%d, checker = %x\n",entry->depth,f.checker);
if((entry->flags & H_LOWER || entry->score <= alpha) && (entry->flags & H_UPPER || entry->score >= beta)) { // compatible bound
d += (score >= beta & entry->depth >= LMR)*reduction; // fail highs need to satisfy reduced depth only, so we fake higher depth than actually found
if((score > alpha && d >= depth || d >= maxDepth) && ply) { // sufficient depth
do { // IID loop
int curMove, highDepth;
iterDepth++;
-if(PATH)printf("%d:%d:%d new iter moveStack[%d..%d]\n",ply,depth,iterDepth,m.firstMove,moveSP);
highDepth = (iterDepth > depth ? iterDepth : depth) - 1; // reply depth for high-failing moves
alpha = startAlpha;
pvPtr = pvStart; *pvPtr++ = 0; // empty PV
for(i=moveNr+ply-1; i>=d; i-=2) if(checkHist[i+1] == CK_NONE) break;
if(i < d) score = -INF; // we deliver a perpetual, so lose
else {
- for(i=moveNr+ply-2; i>=d; i-=2) {if(PATH)printf(" %2d. %d\n",i,checkHist[i+1]);if(checkHist[i+1] == CK_NONE) break;}
+ for(i=moveNr+ply-2; i>=d; i-=2) if(checkHist[i+1] == CK_NONE) break;
if(i < d) score = INF-1; // we are suffering a perpetual, so lose
else if(perpLoses == 1) score = (stm == WHITE ? -INF : INF-1); // mini-Shogi, sente loses
else if(perpLoses == 5) score = -INF; // Tori Shogi, repeating loses
// self-deepening
if(resultDepth > iterDepth) iterDepth = resultDepth; // unexpectedly deep result (from hashed daughters?)
if(reduction && iterDepth == depth) depth += reduction, originalReduction = reduction = 0; // no fail high, start unreduced re-search on behalf of parent
-if(PATH)printf("%d:%d:%d iter end, max=%d, alpha=%d start=%d\n", ply, depth,iterDepth, maxDepth, alpha, startAlpha);
if(iterDepth >= depth && alpha > startAlpha ) break; // move is PV; nominal depth suffices
alpha = startAlpha; // reset alpha for next iteration
entry->depth = resultDepth;
entry->flags = (bestScore > alpha)*H_LOWER + (bestScore < beta)*H_UPPER;
entry->checker = f.checker + 11*(f.checkDist != 0); // encode distant check as off-board checker
-if(PATH || f.hashKey == 0x1348708590)printf("%d:%d Hash store %16llx, d=%d, checker=%x move=%s\n",ply,depth,f.hashKey,resultDepth,entry->checker,MoveToText(entry->move));
// return results
moveSP = oldSP; anaSP = oldAna; pvPtr = pvStart; depthLimit = oldLimit;