From 2f104b7904a48f7f686d3b41d5061e8ef549c5b0 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Sun, 17 Jul 2016 23:14:10 +0200 Subject: [PATCH] Fix disambiguating Pawn moves in Xiangqi When multiple Pawns can go to the same square a move written as to-square only is interpreted as the forward push, rather than a sideway move. --- moves.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/moves.c b/moves.c index 91f0072..25263c8 100644 --- a/moves.c +++ b/moves.c @@ -2163,6 +2163,11 @@ Disambiguate (Board board, int flags, DisambiguateClosure *closure) } } else if(pieceDefs && closure->count > 1 && closure->rtIn >=0) { // [HGM] gen: move is ambiguous under engine-defined rules (and not one-click) DisambiguateClosure spare = *closure; + if(gameInfo.variant == VariantXiangqi && closure->pieceIn == EmptySquare && closure->ffIn < 0) { + closure->ffIn = closure->ftIn; //closure->pieceIn = (flags & 1 ? BlackPawn : WhitePawn); // forward Pawn push has priority + Disambiguate(board, flags, closure); + return; + } pieceDefs = FALSE; spare.count = 0; // See if the (erroneous) built-in rules would resolve that GenLegal(board, flags, DisambiguateCallback, (VOIDSTAR) &spare, closure->pieceIn); if(spare.count == 1) *closure = spare; // It does, so use those in stead (game from file saved before gen patch?) -- 1.7.0.4