From: H.G. Muller Date: Mon, 10 Dec 2012 12:35:41 +0000 (+0100) Subject: Fix min-Shogi promotion zone X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=d80d2310d03f64f801519801c1b8c16f1640aca0 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. --- 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;