q = first.program;\r
while (*q != ' ' && *q != NULLCHAR) q++;\r
p = q;\r
- while (p > first.program && *(p-1) != '/' && *(p-1) != '\\') p--; /* [HGM] bckslash added */\r
+ while (p > first.program && *(p-1) != '/' && *(p-1) != '\\') p--; /* [HGM] backslash added */\r
programVersion = (char*) malloc(8 + strlen(PRODUCT) + strlen(VERSION)\r
+ strlen(PATCHLEVEL) + (q - p));\r
sprintf(programVersion, "%s %s.%s + ", PRODUCT, VERSION, PATCHLEVEL);\r
// don't wait for engine to announce game end if we can judge ourselves\r
switch (MateTest(boards[forwardMostMove], PosFlags(forwardMostMove), epFile,\r
castlingRights[forwardMostMove]) ) {\r
- case MT_NONE:\r
case MT_CHECK:\r
+ if(gameInfo.variant == Variant3Check) { // [HGM] 3check: when in check, test if 3rd time\r
+ int i, checkCnt = 0; // (should really be done by making nr of checks part of game state)\r
+ for(i=forwardMostMove-2; i>=backwardMostMove; i-=2) {\r
+ if(MateTest(boards[i], PosFlags(i), epStatus[i], castlingRights[i]) == MT_CHECK)\r
+ checkCnt++;\r
+ if(checkCnt >= 2) {\r
+ reason = "Xboard adjudication: 3rd check";\r
+ epStatus[forwardMostMove] = EP_CHECKMATE;\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ case MT_NONE:\r
default:\r
break;\r
case MT_STALEMATE:\r