Stalemate is a win in Shogi
authorH.G. Muller <h.g.muller@hccnet.nl>
Fri, 25 Jan 2013 08:55:56 +0000 (09:55 +0100)
committerH.G. Muller <h.g.muller@hccnet.nl>
Fri, 25 Jan 2013 08:56:31 +0000 (09:56 +0100)
In regular Shogi this never occurs, but in the mini variants it happens
often enough.

backend.c
moves.c

index 422bdb9..aafb11f 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -7757,7 +7757,7 @@ Adjudicate (ChessProgramState *cps)
                        boards[forwardMostMove][EP_STATUS] = nrW == nrB ? EP_STALEMATE :
                                                   ((nrW < nrB) != WhiteOnMove(forwardMostMove) ?
                                                                        EP_CHECKMATE : EP_WINS);
-                   else if(gameInfo.variant == VariantShatranj || gameInfo.variant == VariantXiangqi)
+                   else if(gameInfo.variant == VariantShatranj || gameInfo.variant == VariantXiangqi || gameInfo.variant == VariantShogi)
                        boards[forwardMostMove][EP_STATUS] = EP_CHECKMATE; // and in these variants being stalemated loses
                }
                break;
diff --git a/moves.c b/moves.c
index 2b6fd8a..d59542a 100644 (file)
--- a/moves.c
+++ b/moves.c
@@ -1264,7 +1264,7 @@ MateTest (Board board, int flags)
        else if(gameInfo.variant == VariantGiveaway) return MT_STEALMATE; // no check exists, stalemated = win
 
         return inCheck ? MT_CHECKMATE
-                      : (gameInfo.variant == VariantXiangqi || gameInfo.variant == VariantShatranj) ?
+                      : (gameInfo.variant == VariantXiangqi || gameInfo.variant == VariantShatranj || gameInfo.variant == VariantShogi) ?
                          MT_STAINMATE : MT_STALEMATE;
     }
 }