When the board has 7 ranks it is assumed to be Tori Shogi, and the
requirement for maximally one Pawn per file is relaxed to two.
piece == WhiteKnight && rt > BOARD_HEIGHT-3 ||
piece == BlackKnight && rt < 2 ) return IllegalMove; // e.g. where dropped piece has no moves
if(piece == WhitePawn || piece == BlackPawn) {
- int r;
+ int r, max = 1 + (BOARD_HEIGHT == 7); // two Pawns per file in Tori!
for(r=1; r<BOARD_HEIGHT-1; r++)
- if(board[r][ft] == piece) return IllegalMove; // or there already is a Pawn in file
+ if(!(max -= (board[r][ft] == piece))) return IllegalMove; // or there already is a Pawn in file
// should still test if we mate with this Pawn
}
} else if(gameInfo.variant == VariantSChess) { // only back-rank drops