From 599a719d6820131a00de4ecbdc2513989d6e6720 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Fri, 25 Jan 2013 10:05:44 +0100 Subject: [PATCH] Adjudicate perpetual checks as loss also in Shogi The Xiangqi code for recognizing perpetual checks is now also activated for Shogi, but in this case we bail out before checking for perpetual chases. The mini-Shogi case is then recognized as a win for gote. --- backend.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/backend.c b/backend.c index aafb11f..67e2d1b 100644 --- a/backend.c +++ b/backend.c @@ -7859,7 +7859,7 @@ Adjudicate (ChessProgramState *cps) /* adjudicate after user-specified nr of repeats */ int result = GameIsDrawn; char *details = "XBoard adjudication: repetition draw"; - if(gameInfo.variant == VariantXiangqi && appData.testLegality) { + if((gameInfo.variant == VariantXiangqi || gameInfo.variant == VariantShogi) && appData.testLegality) { // [HGM] xiangqi: check for forbidden perpetuals int m, ourPerpetual = 1, hisPerpetual = 1; for(m=forwardMostMove; m>k; m-=2) { @@ -7877,6 +7877,12 @@ Adjudicate (ChessProgramState *cps) if(hisPerpetual && !ourPerpetual) { // he is checking us, but did not repeat yet break; // (or we would have caught him before). Abort repetition-checking loop. } else + if(gameInfo.variant == VariantShogi) { // in Shogi other repetitions are draws + if(BOARD_HEIGHT == 5 && BOARD_RGHT - BOARD_LEFT == 5) { // but in mini-Shogi gote wins! + result = BlackWins; + details = "Xboard adjudication: repetition"; + } + } else // it must be XQ // Now check for perpetual chases if(!ourPerpetual && !hisPerpetual) { // no perpetual check, test for chase hisPerpetual = PerpetualChase(k, forwardMostMove); -- 1.7.0.4