From: H.G. Muller Date: Thu, 16 Sep 2010 16:58:37 +0000 (+0200) Subject: Extend mate test to drop games X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=d0de6f924767f55674690243ebdf126fd98e4906;p=xboard.git Extend mate test to drop games MateTest() in case of no legal moves now also looks if there are legal drops that can resolve the check. This provides reliable mate testing in Crazyhouse and Shogi, so these are now made subject to adjudications too. --- diff --git a/backend.c b/backend.c index 12cef35..d539198 100644 --- a/backend.c +++ b/backend.c @@ -6666,8 +6666,7 @@ Adjudicate(ChessProgramState *cps) ChessProgramState *engineOpponent = (gameMode == TwoMachinesPlay ? cps->other : (cps ? NULL : &first)); Boolean canAdjudicate = !appData.icsActive; - // most tests only when we understand the game, i.e. legality-checking on, and (for the time being) no piece drops - if(gameInfo.holdingsSize == 0 || gameInfo.variant == VariantSuper || gameInfo.variant == VariantGreat) { + // most tests only when we understand the game, i.e. legality-checking on if( appData.testLegality ) { /* [HGM] Some more adjudications for obstinate engines */ int nrW, nrB, bishopColor, staleW, staleB, nr[EmptySquare+1], i; @@ -6819,7 +6818,6 @@ Adjudicate(ChessProgramState *cps) } } else moveCount = 6; } - } if (appData.debugMode) { int i; fprintf(debugFP, "repeat test fmm=%d bmm=%d ep=%d, reps=%d\n", diff --git a/moves.c b/moves.c index f4f33b2..3e58f42 100644 --- a/moves.c +++ b/moves.c @@ -1219,6 +1219,15 @@ int MateTest(board, flags) if (cl.count > 0) { return inCheck ? MT_CHECK : MT_NONE; } else { + if(gameInfo.holdingsWidth && gameInfo.variant != VariantSuper || gameInfo.variant != VariantGreat) { // drop game + int r, f, n, holdings = flags & F_WHITE_ON_MOVE ? BOARD_WIDTH-1 : 0; + for(r=0; r hisPieces ? MT_STAINMATE : MT_STEALMATE;