Fix Alfil bug
authorH.G. Muller <h.g.muller@hccnet.nl>
Sun, 13 Feb 2011 11:18:52 +0000 (12:18 +0100)
committerArun Persaud <apersaud@lbl.gov>
Tue, 15 Feb 2011 06:57:34 +0000 (22:57 -0800)
The test for Alfil (suppressing single steps on the Elephant) contained
a wrong logical operator, so that it could never be active. It also
failed to include Xiangqi as variant with traditional Alfil. This led to
one-step moves of the Elephant in these variants, and false check or
unreliable mate detections.

Fix move of Xiangqi Elephant

moves.c

diff --git a/moves.c b/moves.c
index 769604d..e70df08 100644 (file)
--- a/moves.c
+++ b/moves.c
@@ -419,7 +419,8 @@ void GenPseudoLegal(board, flags, callback, closure)
                           && !SameColor(board[rf][ff], board[rt][ft]))
                                callback(board, flags, NormalMove,
                                         rf, ff, rt, ft, closure);
-                      if(gameInfo.variant == VariantShatranj && gameInfo.variant == VariantCourier) continue; // classical Alfil
+                      if(gameInfo.variant == VariantShatranj || gameInfo.variant == VariantCourier
+                                                             || gameInfo.variant == VariantXiangqi) continue; // classical Alfil
                       rt = rf + rs; // in unknown variant we assume Modern Elephant, which can also do one step
                       ft = ff + fs;
                       if (!(rt < 0 || rt >= BOARD_HEIGHT || ft < BOARD_LEFT || ft >= BOARD_RGHT)