Restrict drops in variant seirawan to back rank
authorH.G. Muller <h.g.muller@hccnet.nl>
Fri, 26 Nov 2010 09:10:55 +0000 (10:10 +0100)
committerArun Persaud <arun@nubati.net>
Fri, 3 Dec 2010 07:14:23 +0000 (23:14 -0800)
Drops aren't really llowed at all in Seirawan Ches, but there exists an
engine that supports a variant where drops on the back-rank are allowed.

moves.c

diff --git a/moves.c b/moves.c
index 6fa6693..6ccbb1c 100644 (file)
--- a/moves.c
+++ b/moves.c
@@ -1043,6 +1043,8 @@ if(appData.debugMode) fprintf(debugFP, "LegalDrop: %d @ %d,%d)\n", piece, ft, rt
                 if(board[r][ft] == piece) return IllegalMove; // or there already is a Pawn in file
             // should still test if we mate with this Pawn
         }
+    } else if(gameInfo.variant == VariantSChess) { // only back-rank drops
+        if (rt != (piece < BlackPawn ? 0 : BOARD_HEIGHT-1)) return IllegalMove;
     } else {
         if( (piece == WhitePawn || piece == BlackPawn) &&
             (rt == 0 || rt == BOARD_HEIGHT -1 ) )