X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=bfdba0fc16b211fd1909b42c8747c30c8c51c6e6;hb=8e489d513f354388fa888b280b7a06dd0b7993e4;hp=734cf407d07818ac4327a4bb8c3fafe55de6f001;hpb=2087ac0f61e84f7f71cbea5a0a3325374f9e76ee;p=xboard.git diff --git a/backend.c b/backend.c index 734cf40..bfdba0f 100644 --- a/backend.c +++ b/backend.c @@ -996,6 +996,7 @@ Load (ChessProgramState *cps, int i) SwapEngines(i); ReplaceEngine(cps, i); FloatToFront(&appData.recentEngineList, engineLine); + if(gameMode == BeginningOfGame) Reset(TRUE, TRUE); return; } p = engineName; @@ -8056,6 +8057,9 @@ SendProgramStatsToFrontend (ChessProgramState * cps, ChessProgramStats * cpstats if(stats.pv && stats.pv[0]) safeStrCpy(lastPV[stats.which], stats.pv, sizeof(lastPV[stats.which])/sizeof(lastPV[stats.which][0])); // [HGM] pv: remember last PV of each + if( gameMode == AnalyzeMode && stats.pv && stats.pv[0] + && appData.analysisBell && stats.time >= 100*appData.analysisBell ) RingBell(); + SetProgramStats( &stats ); } @@ -8948,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]); @@ -9722,7 +9726,7 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h ChessMove mt; int ok = ParseOneMove(bestMove, forwardMostMove, &mt, &ff1, &fr1, &tf1, &tr1, &pp1); ok &= ParseOneMove(pv, forwardMostMove, &mt, &ff2, &fr2, &tf2, &tr2, &pp2); - solvingTime = (ok && ff1==ff2 && fr1==fr2 && tf1==tf2 && tr1==tr2 && pp1==pp2 ? time : -1); + solvingTime = (ok && ff1==ff2 && fr1==fr2 && tf1==tf2 && tr1==tr2 && pp1==pp2 ? (solvingTime < 0 ? time : solvingTime) : -1); } if(serverMoves && (time > 100 || time == 0 && plylev > 7)) { @@ -10789,6 +10793,7 @@ InitChessProgram (ChessProgramState *cps, int setup) b = SupportedVariant(cps->variants, gameInfo.variant, gameInfo.boardWidth, gameInfo.boardHeight, gameInfo.holdingsSize, cps->protocolVersion, cps->tidy); + if (b == NULL) { VariantClass v; char c, *q = cps->variants, *p = strchr(q, ','); @@ -11424,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(); } @@ -11971,7 +11981,10 @@ Reset (int redraw, int init) lastHint[0] = NULLCHAR; ClearGameInfo(&gameInfo); gameInfo.variant = StringToVariant(appData.variant); - if(gameInfo.variant == VariantNormal && strcmp(appData.variant, "normal")) gameInfo.variant = VariantUnknown; + if(gameInfo.variant == VariantNormal && strcmp(appData.variant, "normal")) { + gameInfo.variant = VariantUnknown; + strncpy(engineVariant, appData.variant, MSG_SIZ); + } ics_user_moved = ics_clock_paused = FALSE; ics_getting_history = H_FALSE; ics_gamenum = -1; @@ -13518,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);