X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=zippy.c;h=c77276f08a52b182f5d75fbb765c8f3c22cb24fd;hb=74025874f2010f84fd4f7f2e120e84b56ee9781b;hp=f75ecb2622fbd564e31ae17fb3a9d3b6da361e11;hpb=762e18baef5f815cc46019ba3e082bd5ec1980f6;p=xboard.git diff --git a/zippy.c b/zippy.c index f75ecb2..c77276f 100644 --- a/zippy.c +++ b/zippy.c @@ -88,6 +88,8 @@ extern char *getenv(); #include "backend.h" #include "backendz.h" +char *SendMoveToBookUser P((int nr, ChessProgramState *cps, int initial)); // [HGM] book + static char zippyPartner[MSG_SIZ]; static char zippyLastOpp[MSG_SIZ]; static int zippyConsecGames; @@ -964,7 +966,8 @@ void ZippyFirstBoard(moveNum, basetime, increment) char buf[MSG_SIZ]; int w, b; char *opp = (gameMode==IcsPlayingWhite ? gameInfo.black : gameInfo.white); - Boolean sentPos = FALSE; + Boolean sentPos = FALSE; + char *bookHit = NULL; // [HGM] book if (!first.initDone) { /* Game is starting prematurely. We can't deal with this */ @@ -1035,7 +1038,7 @@ void ZippyFirstBoard(moveNum, basetime, increment) SendTimeRemaining(&first, TRUE); } } - SendToProgram("go\n", &first); + bookHit = SendMoveToBookUser(forwardMostMove-1, &first, TRUE); // [HGM] book: send go or retrieve book move } else { /* Engine's opponent is on move now */ if (first.usePlayother) { @@ -1061,7 +1064,8 @@ void ZippyFirstBoard(moveNum, basetime, increment) SendTimeRemaining(&first, TRUE); } } - SendToProgram("go\n", &first); +// SendToProgram("go\n", &first); + bookHit = SendMoveToBookUser(forwardMostMove-1, &first, TRUE); // [HGM] book: send go or retrieve book move } } } else if (gameMode == IcsPlayingBlack) { @@ -1085,7 +1089,8 @@ void ZippyFirstBoard(moveNum, basetime, increment) SendTimeRemaining(&first, FALSE); } } - SendToProgram("go\n", &first); +// SendToProgram("go\n", &first); + bookHit = SendMoveToBookUser(forwardMostMove-1, &first, TRUE); // [HGM] book: send go or retrieve book move } else { /* Engine's opponent is on move now */ if (first.usePlayother) { @@ -1103,6 +1108,18 @@ void ZippyFirstBoard(moveNum, basetime, increment) /* Nothing needs to be done here */ } } + + if(bookHit) { // [HGM] book: simulate book reply + static char bookMove[MSG_SIZ]; // a bit generous? + + programStats.depth = programStats.nodes = programStats.time = + programStats.score = programStats.got_only_move = 0; + sprintf(programStats.movelist, "%s (xbook)", bookHit); + + strcpy(bookMove, "move "); + strcat(bookMove, bookHit); + HandleMachineMove(bookMove, &first); + } }