From: H.G. Muller Date: Fri, 28 Sep 2012 11:24:33 +0000 (+0200) Subject: Let second engine move in lockstep during dual analysis X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=025a668716d9220ada1d2e3b6b87c8517ac7899a;hp=f38964b851874781439f481fd00b3eef6f592603;p=xboard.git Let second engine move in lockstep during dual analysis When the second engine is also analysing (as indicated by its stat variable second.analyzing), we send all moves / undos / positions / in&excludes that go to the first engine also to second. --- diff --git a/backend.c b/backend.c index a463fa7..6442bea 100644 --- a/backend.c +++ b/backend.c @@ -4898,6 +4898,13 @@ GetMoveListEvent () } void +SendToBoth (char *msg) +{ // to make it easy to keep two engines in step in dual analysis + SendToProgram(msg, &first); + if(second.analyzing) SendToProgram(msg, &second); +} + +void AnalysisPeriodicEvent (int force) { if (((programStats.ok_to_send == 0 || programStats.line_is_book) @@ -4905,8 +4912,7 @@ AnalysisPeriodicEvent (int force) return; /* Send . command to Crafty to collect stats */ - SendToProgram(".\n", &first); - if(second.analyzing) SendToProgram(".\n", &second); + SendToBoth(".\n"); /* Don't send another until we get a response (this makes us stop sending to old Crafty's which don't understand @@ -6222,7 +6228,7 @@ ExcludeOneMove (int fromY, int fromX, int toY, int toX, char promoChar, char sta // inform engine snprintf(buf, MSG_SIZ, "%sclude ", state == '+' ? "in" : "ex"); CoordsToComputerAlgebraic(fromY, fromX, toY, toX, promoChar, buf+8); - SendToProgram(buf, &first); + SendToBoth(buf); return (state == '+'); } @@ -6235,16 +6241,16 @@ ExcludeClick (int index) if(index < 13) { // none: include all WriteMap(0); // clear map for(i=0; i 18) { // tail if(exclusionHeader[19] == '-') { // tail was excluded - SendToProgram("include all\n", &first); + SendToBoth("include all\n"); WriteMap(0); // clear map completely // now re-exclude selected moves for(i=0; i target) { if(moveList[currentMove-1][1] == '@' && moveList[currentMove-1][0] == '@') { // null move cannot be undone. Reload program with move history before it. @@ -14700,10 +14707,14 @@ BackwardInner (int target) if(moveList[i-1][1] == '@' && moveList[i-1][0] == '@') break; } SendBoard(&first, i); - for(currentMove=i; currentMove