#include "backend.h"\r
#include "backendz.h"\r
\r
+char *SendMoveToBookUser P((int nr, ChessProgramState *cps, int initial)); // [HGM] book
+
static char zippyPartner[MSG_SIZ];\r
static char zippyLastOpp[MSG_SIZ];\r
static int zippyConsecGames;\r
char buf[MSG_SIZ];\r
int w, b;\r
char *opp = (gameMode==IcsPlayingWhite ? gameInfo.black : gameInfo.white);\r
- Boolean sentPos = FALSE;\r
+ Boolean sentPos = FALSE;
+ char *bookHit = NULL; // [HGM] book\r
\r
if (!first.initDone) {\r
/* Game is starting prematurely. We can't deal with this */\r
SendTimeRemaining(&first, TRUE);\r
}\r
}\r
- SendToProgram("go\n", &first);\r
+ bookHit = SendMoveToBookUser(forwardMostMove-1, &first, TRUE); // [HGM] book: send go or retrieve book move\r
} else {\r
/* Engine's opponent is on move now */\r
if (first.usePlayother) {\r
SendTimeRemaining(&first, TRUE);\r
}\r
}\r
- SendToProgram("go\n", &first);\r
+// SendToProgram("go\n", &first);\r
+ bookHit = SendMoveToBookUser(forwardMostMove-1, &first, TRUE); // [HGM] book: send go or retrieve book move\r
}\r
}\r
} else if (gameMode == IcsPlayingBlack) {\r
SendTimeRemaining(&first, FALSE);\r
}\r
}\r
- SendToProgram("go\n", &first);\r
+// SendToProgram("go\n", &first);\r
+ bookHit = SendMoveToBookUser(forwardMostMove-1, &first, TRUE); // [HGM] book: send go or retrieve book move\r
} else {\r
/* Engine's opponent is on move now */\r
if (first.usePlayother) {\r
/* Nothing needs to be done here */\r
} \r
}\r
+
+ 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);
+ }
}\r
\r
\r