DrawPosition(TRUE, boards[currentMove]);
}
+int
+MultiPV(ChessProgramState *cps)
+{ // check if engine supports MultiPV, and if so, return the nmber of the option that sets it
+ int i;
+ for(i=0; i<cps->nrOptions; i++)
+ if(!strcmp(cps->option[i].name, "MultiPV") && cps->option[i].type == Spin)
+ return i;
+ return -1;
+}
+
Boolean
LoadMultiPV(int x, int y, char *buf, int index, int *start, int *end)
{
- int startPV;
- char *p;
+ int startPV, multi, lineStart, origIndex = index;
+ char *p, buf2[MSG_SIZ];
if(index < 0 || index >= strlen(buf)) return FALSE; // sanity
lastX = x; lastY = y;
while(index > 0 && buf[index-1] != '\n') index--; // beginning of line
- startPV = index;
+ lineStart = startPV = index;
while(buf[index] != '\n') if(buf[index++] == '\t') startPV = index;
if(index == startPV && (p = StrCaseStr(buf+index, "PV="))) startPV = p - buf + 3;
index = startPV;
do{ while(buf[index] && buf[index] != '\n') index++;
} while(buf[index] == '\n' && buf[index+1] == '\\' && buf[index+2] == ' ' && index++); // join kibitzed PV continuation line
buf[index] = 0;
+ if(lineStart == 0 && gameMode == AnalyzeMode && (multi = MultiPV(&first)) >= 0) {
+ int n = first.option[multi].value;
+ if(origIndex < 10) { if(n>1) n--; } else if(origIndex > index - 6) n++;
+ snprintf(buf2, MSG_SIZ, "option MultiPV=%d\n", n);
+ if(first.option[multi].value != n) SendToProgram(buf2, &first);
+ first.option[multi].value = n;
+ *start = *end = 0;
+ return TRUE;
+ }
ParsePV(buf+startPV, FALSE, !shiftKey);
*start = startPV; *end = index-1;
return TRUE;
void SettingsPopUp P((ChessProgramState *cps)); // [HGM] really in front-end, but CPS not known in frontend.h
int WaitForEngine P((ChessProgramState *cps, DelayedEventCallback x));
void Load P((ChessProgramState *cps, int n));
+int MultiPV P((ChessProgramState *cps));
#endif /* _BACKEND */
static int lastForwardMostMove[2] = { -1, -1 };
static int engineState[2] = { -1, -1 };
static char lastLine[2][MSG_SIZ];
+static char header[MSG_SIZ];
#define MAX_VAR 400
static int scores[MAX_VAR], textEnd[MAX_VAR], curDepth[2], nrVariations[2];
{
EngineOutputData ed;
int clearMemo = FALSE;
- int which;
- int depth;
+ int which, depth, multi;
if( stats == 0 ) {
SetEngineState( 0, STATE_IDLE, "" );
if( clearMemo ) {
DoClearMemo(which); nrVariations[which] = 0;
+ header[0] = NULLCHAR;
+ if(gameMode == AnalyzeMode && (multi = MultiPV(&first)) >= 0) {
+ snprintf(header, MSG_SIZ, "\t\t\t\tfewer / Multi-PV setting = %d / more\n",
+ first.option[multi].value);
+ InsertIntoMemo( which, header, 0);
+ } else
if(appData.ponderNextMove && lastLine[which][0]) {
InsertIntoMemo( which, lastLine[which], 0 );
InsertIntoMemo( which, "\n", 0 );
scores[n] = newScore;
}
nrVariations[n] += 2;
- return offs;
+ return offs + (gameMode == AnalyzeMode)*strlen(header);
}