From 58b79b90c17a718bdbc2176f20d4bc89adccebc9 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Sat, 26 Mar 2016 23:35:51 +0100 Subject: [PATCH] Add more EPD code The -epd option now causes color assignment such that the first engine plays all moves. Extraction of the bm field from the EPD is fixed, and clearing of the second engine-output pane is suppressed. --- backend.c | 11 ++++++++--- engineoutput.c | 4 +++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/backend.c b/backend.c index 4a97a87..7f8bc87 100644 --- a/backend.c +++ b/backend.c @@ -8952,7 +8952,7 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h } if(appData.epd) { if(solvingTime >= 0) { - snprintf(buf1, MSG_SIZ, "%d. %4.2fs\n", matchGame, solvingTime/100.); + snprintf(buf1, MSG_SIZ, "%d. solved %4.2fs\n", matchGame, solvingTime/100.); totalTime += solvingTime; first.matchWins++; } else { snprintf(buf1, MSG_SIZ, "%d. wrong (%s)\n", matchGame, parseList[backwardMostMove]); @@ -11429,6 +11429,11 @@ NextMatchGame () res = LoadGameOrPosition(matchGame); // setup game appData.noChessProgram = FALSE; // LoadGameOrPosition might call Reset too! if(!res) return; // abort when bad game/pos file + if(appData.epd) {// in EPD mode we make sure first engine is to move + firstWhite = !(forwardMostMove & 1); + first.twoMachinesColor = firstWhite ? "white\n" : "black\n"; // perform actual color assignement + second.twoMachinesColor = firstWhite ? "black\n" : "white\n"; + } TwoMachinesEvent(); } @@ -13526,8 +13531,8 @@ LoadPosition (FILE *f, int positionNumber, char *title) DisplayError(_("Bad FEN position in file"), 0); return FALSE; } - if((p = strstr(line, ";")) && (p = strstr(p+1, "bm "))) { // EPD with best move - sscanf(p+3, "%s", bestMove); + if((strchr(line, ';')) && (p = strstr(line, " bm "))) { // EPD with best move + sscanf(p+4, "%s", bestMove); } else *bestMove = NULLCHAR; } else { (void) fgets(line, MSG_SIZ, f); diff --git a/engineoutput.c b/engineoutput.c index 4e00960..6fd6662 100644 --- a/engineoutput.c +++ b/engineoutput.c @@ -187,6 +187,8 @@ SetProgramStats (FrontEndProgramStats * stats) // now directly called by back-en return; } + if(appData.epd && which) return; // do not write second pane in -epd mode + if( !EngineOutputDialogExists() ) { return; } @@ -697,7 +699,7 @@ OutputKibitz (int window, char *text) static int currentLineEnd[2]; int where = 0; if(!EngineOutputIsUp()) return; - if(!opponentKibitzes) { // on first kibitz of game, clear memos + if(!opponentKibitzes && !appData.epd) { // on first kibitz of game, clear memos DoClearMemo(1); currentLineEnd[1] = 0; if(gameMode == IcsObserving) { DoClearMemo(0); currentLineEnd[0] = 0; } } -- 1.7.0.4