From 8b31dd8ad2918a8e1397a86a092cb21eb4ae7415 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Mon, 6 Feb 2017 22:27:05 +0100 Subject: [PATCH] Keep track of checking history An array checkHist[] records checks from the game as well as the search. --- dropper.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dropper.c b/dropper.c index 2f12c4f..0b19726 100644 --- a/dropper.c +++ b/dropper.c @@ -71,6 +71,7 @@ int handVal[96], rawGain[97]; unsigned int moveStack[500*MAXPLY]; int killers[MAXPLY][2]; int path[MAXPLY], deprec[MAXPLY]; +unsigned char checkHist[MAXMOVES+MAXPLY]; int repKey[512+20]; /* @@ -1055,6 +1056,7 @@ MakeMove (StackFrame *f, int move) stm = f->toPiece & COLOR; f->bulk = promoGain[stm+30]; promoGain[stm+30] += handBulk[f->victim] - dropBulk[f->fromSqr]; location[f->toPiece] = f->toSqr; + checkHist[moveNr+ply+1] = f->checker; return 1; } @@ -1153,7 +1155,7 @@ if(hashMove && board[hashMove>>8&255] == 0) {char s[100];sprintf(s,"bad hash mov if(depth - reduction < LMR) reduction = depth - LMR; // never reduce to below 'LMR' ply depth -= reduction; } else reduction = originalReduction = 0; -if(PATH)printf("%d:%d {%d,%d} max=%d eval=%d check=%02x,%d,%d\n",ply,depth,alpha,beta,maxDepth,curEval,f.checker,f.checkDir,f.checkDist); + checkHist[moveNr+ply+1] = f.checker; // stand pat or null move startAlpha = alpha; startScore = -INF; if(depth <= 0) { // QS @@ -1537,11 +1539,17 @@ RootMakeMove(int move) { int index; // irreversibly adopt incrementally updated values from last move as new starting point + MoveStack m; + int checker; undoInfo.pstEval = -undoInfo.newEval; // (like we initialize new Stackframe in daughter node) undoInfo.hashKey = undoInfo.newKey; undoInfo.rights |= spoiler[undoInfo.fromSqr] | spoiler[undoInfo.toSqr]; - undoInfo.checker = CK_NONE; + undoInfo.checker = CK_NONE; // make sure move will not be rejected + moveSP = 48; + checker = (MoveGen(stm ^ COLOR, &m, undoInfo.rights) ? CK_DOUBLE : CK_NONE); // test if we are in check by generating opponent moves + moveSP = 0; // and throw away those moves MakeMove(&undoInfo, move); + checkHist[moveNr+1] = checker; // store in game history hash table index = (unsigned int)undoInfo.newKey >> 24 ^ stm << 2; // uses high byte of low (= hands-free) key while(repKey[index] && (repKey[index] ^ (int)undoInfo.newKey) & 0x1FFFFF) index += 2; // find empty slot -- 1.7.0.4