From eee00f8afcf0a979c6b6d6a159b0b4181d0cf747 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Mon, 4 Oct 2010 09:41:11 +0200 Subject: [PATCH] Suppress spurious use of SAN castling in mini variants King moves from a central file to the king-side-castled position (1 square away from the right corner) were intercepted and printed as O-O in CoordsToAlgebraic. But on a 5x5 board (mini-Shogi!) this caught the normal King move Kc1-d1 as well. The castling notation is now reserved for King moves larger than one step. --- moves.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/moves.c b/moves.c index 2069b9d..2e8d672 100644 --- a/moves.c +++ b/moves.c @@ -1521,6 +1521,7 @@ ChessMove CoordsToAlgebraic(board, flags, rf, ff, rt, ft, promoChar, out) /* Use style "O-O" (oh-oh) for PGN compatibility */ else if (rf == rt && rf == ((piece == WhiteKing) ? 0 : BOARD_HEIGHT-1) && + (ft - ff > 1 || ff - ft > 1) && // No castling if legal King move (on narrow boards!) ((ff == BOARD_WIDTH>>1 && (ft == BOARD_LEFT+2 || ft == BOARD_RGHT-2)) || (ff == (BOARD_WIDTH-1)>>1 && (ft == BOARD_LEFT+1 || ft == BOARD_RGHT-3)))) { if(ft==BOARD_LEFT+1 || ft==BOARD_RGHT-2) -- 1.7.0.4