From 8d2b7ffab40c918bc7f806dbc04a439298da32f3 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Mon, 15 May 2017 22:14:21 +0200 Subject: [PATCH] Rehash repetition keys in steps of 1 The repetition key hash table does not store white and black moves alternately, but in different halves of the table, so to find a slot for re-hashing we better hunt for empty slots in steps of 1. --- dropper.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dropper.c b/dropper.c index 1200942..ad36e37 100644 --- a/dropper.c +++ b/dropper.c @@ -1330,7 +1330,7 @@ if(PATH)printf("%d:%d:%d new iter moveStack[%d..%d]\n",ply,depth,iterDepth,m.fir // repetition checking int index = (unsigned int)f.newKey >> 24 ^ stm << 2; // uses high byte of low (= hands-free) key - while(repKey[index] && (repKey[index] ^ (int)f.newKey) & 0x1FFFFF) index += 2; + while(repKey[index] && (repKey[index] ^ (int)f.newKey) & 0x1FFFFF) index++; int oldRepKey = repKey[index], oldRepDep = repDep[index]; if(oldRepKey && ff->mutation != -2) { // key present in table: (quasi-)repetition int gain = (f.newEval << 21) - (repKey[index] & 0xFFE00000); @@ -1672,7 +1672,7 @@ RootMakeMove(int move) if(moveNr >= 19 && !perpLoses) PST[WHITE+1] = knightPST, PST[BLACK+1] = knightPST + 11; // 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 + while(repKey[index] && (repKey[index] ^ (int)undoInfo.newKey) & 0x1FFFFF) index++; // find empty slot repKey[index] = (int)undoInfo.newKey & 0x1FFFFF | undoInfo.newEval << 21; // remember position repDep[index] = moveNr; stm ^= COLOR; moveNr++; -- 1.7.0.4