From 0547eaa10ec8df7807fceb591c9692c77081afab Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Sat, 1 Jun 2013 10:07:21 +0200 Subject: [PATCH] Implement pondering on position / analysis Pondering is indicated by setting abortFlag to -1. This suppresses testing on time, both in TerminalCheck() and at the end of an iteration. --- hachu.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/hachu.c b/hachu.c index ff5cc8f..0b06fbb 100644 --- a/hachu.c +++ b/hachu.c @@ -1853,7 +1853,7 @@ if(PATH) printf("%d:%2d:%d %3d %6x %-10s %6d %6d\n", level, depth, iterDep, curM printf("\n"); fflush(stdout); } - if(GetTickCount() - startTime > tlim1) break; // do not start iteration we can (most likely) not finish + if(!(abortFlag & 1) && GetTickCount() - startTime > tlim1) break; // do not start iteration we can (most likely) not finish } replyDep = iterDep; #ifdef HASH @@ -2261,6 +2261,9 @@ MapFromScratch(attacks); void PonderUntilInput (int stm) { +MapFromScratch(attacks); + repCnt = 0; abortFlag = -1; + Search(-INF-1, INF+1, rootEval, maxDepth, sup1, sup2); } int TakeBack(int n) @@ -2297,6 +2300,7 @@ printf("# setup done");fflush(stdout); if(!strcmp(command, "put")) { ReadSquare(inBuf+4, &lastPut); continue; } // ditto if(!strcmp(command, ".")) { inBuf[0] = 0; return; } // ignore for now if(!strcmp(command, "lift")) { inBuf[0] = 0; Highlight(inBuf+5); return; } // treat here + abortFlag = 1; return; } } @@ -2304,7 +2308,11 @@ printf("# setup done");fflush(stdout); void TerminationCheck() { + if(abortFlag < 0) { // check for input + if(InputWaiting()) GetLine(0); // read & examine input command + } else { // check for time if(GetTickCount() - startTime > tlim3) abortFlag = 2; + } } main() -- 1.7.0.4