From: H.G. Muller Date: Sun, 1 Apr 2012 20:39:55 +0000 (+0200) Subject: Keep list of excluded moves in Engine Output header X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=c082824a507c0fb577beb908ed5615a161c6c6fa;p=xboard.git Keep list of excluded moves in Engine Output header As long as there is still space, excluded or included moves are added to a new header line in the Engine Output window (prefixed with + or - depending on whether they are currently excluded or included). Future in/exclusions of that same move then alter the prefix. --- diff --git a/backend.c b/backend.c index 4ceb598..e314d42 100644 --- a/backend.c +++ b/backend.c @@ -5426,6 +5426,9 @@ LoadMultiPV (int x, int y, char *buf, int index, int *start, int *end) first.option[multi].value = n; *start = *end = 0; return FALSE; + } else if(strstr(buf+lineStart, "exclude:") == buf+lineStart) { // exclude moves clicked + DisplayNote("Yes!"); + return; } ParsePV(buf+startPV, FALSE, gameMode != AnalyzeMode); *start = startPV; *end = index-1; @@ -6104,6 +6107,45 @@ SendBoard (ChessProgramState *cps, int moveNum) setboardSpoiledMachineBlack = 0; /* [HGM] assume WB 4.2.7 already solves this after sending setboard */ } +char exclusionHeader[MSG_SIZ]; +int exCnt, excludePtr, mappedMove = -1; +typedef struct { int ff, fr, tf, tr, pc, mark; } Exclusion; +static Exclusion excluTab[200]; +static char excludeMap[(BOARD_RANKS*BOARD_FILES*BOARD_RANKS*BOARD_FILES+7)/8]; // [HGM] exclude: bitmap for excluced moves + +void +ClearMap () +{ + int j; + mappedMove = -1; + for(j=0; j<(BOARD_RANKS*BOARD_FILES*BOARD_RANKS*BOARD_FILES+7)/8; j++) excludeMap[j] = 0; + safeStrCpy(exclusionHeader, "exclude: none best tail \n", MSG_SIZ); + excludePtr = 24; exCnt = 0; +} + +void +UpdateExcludeHeader (int fromY, int fromX, int toY, int toX, char promoChar, int incl) +{ + char buf[2*MOVE_LEN], *p, c = incl ? '+' : '-'; + Exclusion *e = excluTab; + int i; + for(i=0; i>= 3; snprintf(buf, MSG_SIZ, "%sclude ", excludeMap[i] & 1<= 0) { + if(gameMode == AnalyzeMode) { + if((multi = MultiPV(&first)) >= 0) { snprintf(header, MSG_SIZ, "\t%s viewpoint\t\tfewer / Multi-PV setting = %d / more\n", appData.whitePOV || appData.scoreWhite ? "white" : "mover", first.option[multi].value); - InsertIntoMemo( which, header, 0); + } + snprintf(header+strlen(header), MSG_SIZ-strlen(header), exclusionHeader); + InsertIntoMemo( which, header, 0); } else if(appData.ponderNextMove && lastLine[which][0]) { InsertIntoMemo( which, lastLine[which], 0 ); diff --git a/engineoutput.h b/engineoutput.h index 918d97e..8c396d2 100644 --- a/engineoutput.h +++ b/engineoutput.h @@ -55,6 +55,7 @@ #define STATE_ANALYZING 3 extern int windowMode; +extern char exclusionHeader[]; // back-end called by front-end void SetEngineState( int which, int state, char * state_data );