From d80d2310d03f64f801519801c1b8c16f1640aca0 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Mon, 10 Dec 2012 13:35:41 +0100 Subject: [PATCH] Fix min-Shogi promotion zone In integer arithmetic N*2/3 is not the same as N - N/3, with as a result that the white promotion zone was 2 ranks deep on 5x5 boards. This only happened in LegalityTest, but because this would classify all moves to 4th rank an non-promotions, they would be printed with a faulty deferral (=) sign as promochar in SAN. --- moves.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/moves.c b/moves.c index 5f4b3f9..ecd7b48 100644 --- a/moves.c +++ b/moves.c @@ -1151,7 +1151,7 @@ if(appData.debugMode)fprintf(debugFP,"SHOGI promoChar = %c\n", promoChar ? promo return CharToPiece(promoChar) == EmptySquare ? ImpossibleMove : IllegalMove; else if(flags & F_WHITE_ON_MOVE) { if( (int) piece < (int) WhiteWazir && - (rf >= BOARD_HEIGHT*2/3 || rt >= BOARD_HEIGHT*2/3) ) { + (rf >= BOARD_HEIGHT - BOARD_HEIGHT/3 || rt >= BOARD_HEIGHT - BOARD_HEIGHT/3) ) { if( (piece == WhitePawn || piece == WhiteQueen) && rt > BOARD_HEIGHT-2 || piece == WhiteKnight && rt > BOARD_HEIGHT-3) /* promotion mandatory */ cl.kind = promoChar == '=' ? IllegalMove : WhitePromotion; -- 1.7.0.4