From fae6216ac24b51714583d313f9213d90f9fd4fbc Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Sat, 22 Dec 2012 20:25:51 +0100 Subject: [PATCH] Fix rep-draw detection in drop games In games like Crazyhouse every move is reversible, as captured pieces can eventually change sides again, and be dropped back on the board. So we have to search back a full 100 ply for repetitions, passing captures and Pawn moves. --- backend.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/backend.c b/backend.c index d78319a..6e24b1a 100644 --- a/backend.c +++ b/backend.c @@ -7666,7 +7666,7 @@ Adjudicate (ChessProgramState *cps) // In any case it determnes if the game is a claimable draw (filling in EP_STATUS). // Actually ending the game is now based on the additional internal condition canAdjudicate. // Only when the game is ended, and the opponent is a computer, this opponent gets the move relayed. - int k, count = 0; static int bare = 1; + int k, drop, count = 0; static int bare = 1; ChessProgramState *engineOpponent = (gameMode == TwoMachinesPlay ? cps->other : (cps ? NULL : &first)); Boolean canAdjudicate = !appData.icsActive; @@ -7821,10 +7821,12 @@ Adjudicate (ChessProgramState *cps) /* Check for rep-draws */ count = 0; + drop = gameInfo.holdingsSize && (gameInfo.variant != VariantSuper && gameInfo.variant != VariantSChess + && gameInfo.variant != VariantGreat && gameInfo.variant != VariantGrand); for(k = forwardMostMove-2; - k>=backwardMostMove && k>=forwardMostMove-100 && + k>=backwardMostMove && k>=forwardMostMove-100 && (drop || (signed char)boards[k][EP_STATUS] < EP_UNKNOWN && - (signed char)boards[k+2][EP_STATUS] <= EP_NONE && (signed char)boards[k+1][EP_STATUS] <= EP_NONE; + (signed char)boards[k+2][EP_STATUS] <= EP_NONE && (signed char)boards[k+1][EP_STATUS] <= EP_NONE); k-=2) { int rights=0; if(CompareBoards(boards[k], boards[forwardMostMove])) { -- 1.7.0.4