EP_NONE, castlingRights[m-1]) != MT_CHECK)\r
hisPerpetual = 0; // the opponent did not always check\r
}\r
+ if(appData.debugMode) fprintf(debugFP, "XQ perpetual test, our=%d, his=%d\n",\r
+ ourPerpetual, hisPerpetual);\r
if(ourPerpetual && !hisPerpetual) { // we are actively checking him: forfeit\r
GameEnds( WhiteOnMove(forwardMostMove) ? WhiteWins : BlackWins, \r
"Xboard adjudication: perpetual checking", GE_XBOARD );\r
}\r
if(hisPerpetual && !ourPerpetual) // he is checking us, but did not repeat yet\r
break; // (or we would have caught him before). Abort repetition-checking loop.\r
- // if neither of us is checking all the time, or both are, it is draw\r
- // (illegal-chase forfeits not implemented yet!)\r
+ // Now check for perpetual chases\r
+ if(!ourPerpetual && !hisPerpetual) { // no perpetual check, test for chase\r
+ hisPerpetual = PerpetualChase(k, forwardMostMove);\r
+ ourPerpetual = PerpetualChase(k+1, forwardMostMove);\r
+ if(ourPerpetual && !hisPerpetual) { // we are actively checking him: forfeit\r
+ GameEnds( WhiteOnMove(forwardMostMove) ? WhiteWins : BlackWins, \r
+ "Xboard adjudication: perpetual chasing", GE_XBOARD );\r
+ return;\r
+ }\r
+ if(hisPerpetual && !ourPerpetual) // he is chasing us, but did not repeat yet\r
+ break; // Abort repetition-checking loop.\r
+ }\r
+ // if neither of us is checking or chasing all the time, or both are, it is draw\r
}\r
GameEnds( GameIsDrawn, "Xboard adjudication: repetition draw", GE_XBOARD );\r
return;\r