From a757b3271db7ac0bfeb15fd68ea36b17be9e1e0a Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Thu, 21 Apr 2016 22:47:18 +0200 Subject: [PATCH] Fix confinement of Advisor in Xiangqi Ever since the move-generator rewrite the Advisor could leave the Palace! Now it can only move in XQ as a normal Ferz when on the board axis, and everywhere els it can only move to the axis one square from the edge. This does not generalize in a natural way to larger boards or larger Palaces. --- moves.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/moves.c b/moves.c index cc3343b..a5ec955 100644 --- a/moves.c +++ b/moves.c @@ -1179,6 +1179,12 @@ GenPseudoLegal (Board board, int flags, MoveCallback callback, VOIDSTAR closure, case WhiteFerz: case BlackFerz: + if(gameInfo.variant == VariantXiangqi && ff != BOARD_WIDTH>>1) { + int rt = (piece == BlackFerz ? BOARD_HEIGHT-2 : 1); + int ft = BOARD_WIDTH>>1; + if(!SameColor(board[rf][ff], board[rt][ft])) + callback(board, flags, NormalMove, rf, ff, rt, ft, closure); + } else /* [HGM] support Shatranj pieces */ Ferz(board, flags, rf, ff, callback, closure); break; -- 1.7.0.4