From af3a8b2625ff5f715af2b306dd486ed9cad4e790 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Fri, 7 Mar 2014 12:50:07 +0100 Subject: [PATCH] Add time increment after move in XBoard mode Adding the increment with Fischer clocks was done in SetResponseTime, so it was included in the time for the current move. The time would normally already have been added through the 'time' command, however, so the engine would count itself rich by this, and could be flagged. In XBoard mode the time increment is now added after the move (just in case the GUI would not send 'time' commands, which would overrule it anyway before we have to move next). --- gnushogi/search.c | 5 ++++- gnushogi/tcontrl.c | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gnushogi/search.c b/gnushogi/search.c index ee7b402..f950a6d 100644 --- a/gnushogi/search.c +++ b/gnushogi/search.c @@ -451,8 +451,11 @@ SelectMove(short side, SelectMove_mode iop) /* If Time Control get the elapsed time */ if (TCflag) + { ElapsedTime(COMPUTE_AND_INIT_MODE); - + if(xboard) /* In XBoard increment is added after move */ + TimeControl.clock[side] += TCadd; + } /* update time control info */ dsp->OutputMove(); diff --git a/gnushogi/tcontrl.c b/gnushogi/tcontrl.c index 691f5ae..4e1da41 100644 --- a/gnushogi/tcontrl.c +++ b/gnushogi/tcontrl.c @@ -164,7 +164,8 @@ void SetResponseTime(short side) short rtf = in_opening_stage ? 8 : 2; short tcq = in_opening_stage ? 2 : 4; - TimeControl.clock[side] += TCadd; + if(!xboard) /* no pre-add of increment in XBoard mode */ + TimeControl.clock[side] += TCadd; ResponseTime = (TimeControl.clock[side]) / (((TimeControl.moves[side]) * rtf) + 1); TCleft = (long)ResponseTime / tcq; @@ -252,7 +253,9 @@ void SetResponseTime(short side) else { /* calculate avg time per move remaining */ - TimeControl.clock[side] += TCadd; + + if(!xboard) /* no pre-add of increment in XBoard mode */ + TimeControl.clock[side] += TCadd; ResponseTime = (TimeControl.clock[side]) / (((TimeControl.moves[side]) * 2) + 1); -- 1.7.0.4