From 8f4285640c000dccb97fe0cb325b1ee5ea69a0c2 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Mon, 2 Jun 2014 19:59:49 +0200 Subject: [PATCH] Use returned depth in hash table The depth returned by the search is now also hashed. This gives an enormous speedup of tsume searches, as mates are assigned 'infinite' depth, and thus forced distant mates also, so that they remain valid in subsequent iterations without re-search. For safety the depth assigned to repetitions was limited to the current iteration. --- hachu.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/hachu.c b/hachu.c index ffde08b..f058616 100644 --- a/hachu.c +++ b/hachu.c @@ -2027,6 +2027,7 @@ if(flag & depth >= 0) printf("%2d:%d found %d/%d %08x %s\n", depth, iterDep, cur if(flag & depth >= 0) printf("%2d:%d made %d/%d %s\n", depth, iterDep, curMove, msp, MoveToText(moveStack[curMove], 0)); for(i=2; i<=cnt50; i+=2) if(repStack[level-i+200] == hashKeyH) { + retDep = iterDep; if(repDraws) { score = 0; goto repetition; } if(!allowRep) { moveStack[curMove] = 0; // erase forbidden move @@ -2146,7 +2147,7 @@ if(PATH) printf("%d:%2d:%d %3d %6x %-10s %6d %6d (%d)\n", level, depth, iterDep #ifdef HASH // hash store hashTable[index].lock[hit] = hashKeyH; - hashTable[index].depth[hit] = iterDep; + hashTable[index].depth[hit] = resDep; hashTable[index].score[hit] = bestScore; hashTable[index].flag[hit] = (bestScore < beta) * H_UPPER; if(bestScore > alpha) { -- 1.7.0.4