From 17578788289cee451a7bceff1cda802cc692ffc9 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Fri, 7 Mar 2014 10:47:38 +0100 Subject: [PATCH] Take account of multi-session TC while pondering We now call RenewTimeControl rather than SetTimeControl to calculate the new TC parameters when a ponder search produces a move after a ponder hit, to mimic what would happen if the computer thinks in the main loop. When accepting the ponder move during search we should be more careful, because calling the SetTimeControl (indirectly) there would interfere with the 'time' and 'otim' commands received just before the move, which already include the time for the next session. So there we only set the number of moves when a new session starts. This would not take account of multi-session TCs, but in XBoard mode there shouldn't be any. --- gnushogi/commondsp.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/gnushogi/commondsp.c b/gnushogi/commondsp.c index 802bb1b..6272918 100644 --- a/gnushogi/commondsp.c +++ b/gnushogi/commondsp.c @@ -1600,8 +1600,6 @@ ReadFEN(char *fen) } -/* FIXME! This is truly the function from hell! */ - /* * Process the user's command. If easy mode is OFF (the computer is thinking * on opponents time) and the program is out of book, then make the 'hint' @@ -1682,8 +1680,7 @@ PonderOnHintMove(void) ElapsedTime(COMPUTE_AND_INIT_MODE); GameList[GameCnt-1].time = (short) (et + 50)/100; /* FIXME: this is wrong */ - if(TCflag && TimeControl.moves[computer] == 0) - SetTimeControl(); /* add time for next session */ + RenewTimeControl(computer); /* add time for next session */ } Sdepth = 0; } @@ -2241,8 +2238,8 @@ InputCommand(int root) { /* account opponent time and moves */ TimeControl.clock[opponent] -= et; timeopp[oppptr] = et; - --TimeControl.moves[opponent]; - if(TimeControl.moves[computer] == 0) SetTimeControl(); + if (--TimeControl.moves[opponent] == 0) + TimeControl.moves[opponent] = TCmoves; /* assumes uni-TC! */ } SetResponseTime(computer); strcpy(ponderString, "hit"); -- 1.7.0.4