Adjudicate pawn-drop mate as loss in Shogi
authorH.G. Muller <h.g.muller@hccnet.nl>
Sat, 26 Jan 2013 17:08:37 +0000 (18:08 +0100)
committerH.G. Muller <h.g.muller@hccnet.nl>
Sat, 26 Jan 2013 17:08:37 +0000 (18:08 +0100)
Mating with a Pawn drop is illegal in Shogi, but rather than burdoning
the legality-testing by this complex rule, we simply invert the result
for such a mate. After all, Shogi customs are such that everything illegal
leads to an immediate loss.

backend.c

index 67e2d1b..2028269 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -7764,6 +7764,14 @@ Adjudicate (ChessProgramState *cps)
              case MT_CHECKMATE:
                reason = "Xboard adjudication: Checkmate";
                boards[forwardMostMove][EP_STATUS] = (gameInfo.variant == VariantLosers ? EP_WINS : EP_CHECKMATE);
+               if(gameInfo.variant == VariantShogi) {
+                   if(forwardMostMove > backwardMostMove
+                      && moveList[forwardMostMove-1][1] == '@'
+                      && CharToPiece(ToUpper(moveList[forwardMostMove-1][0])) == WhitePawn) {
+                       reason = "XBoard adjudication: pawn-drop mate";
+                       boards[forwardMostMove][EP_STATUS] = EP_WINS;
+                   }
+               }
                break;
            }