From: H.G.Muller Date: Mon, 6 Apr 2020 17:34:22 +0000 (+0200) Subject: Adapt gating legality test to holdingless case X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=6d159d80e9721872429e0c83b2ff9c60da80e1bd;p=xboard.git Adapt gating legality test to holdingless case The test in Disambiguate() to see if an indicated gating is legal now is aware that in holdingless Seirawan gating takes place on the second rank. It also reserves the test for RxK castling to the case with holdings. --- diff --git a/moves.c b/moves.c index 2574fd0..032b6b0 100644 --- a/moves.c +++ b/moves.c @@ -2239,17 +2239,21 @@ Disambiguate (Board board, int flags, DisambiguateClosure *closure) if (c == 'x') c = NULLCHAR; // get rid of any 'x' (which should never happen?) if(gameInfo.variant == VariantSChess && c && c != '=' && closure->piece != WhitePawn && closure->piece != BlackPawn) { if(closure->piece < BlackPawn) { // white - if(closure->rf != 0) closure->kind = IllegalMove; // must be on back rank - if(!(board[VIRGIN][closure->ff] & VIRGIN_W)) closure->kind = IllegalMove; // non-virgin + if(closure->rf != !gameInfo.holdingsSize) closure->kind = IllegalMove; // must be on back rank + if(!(board[VIRGIN][closure->ff] & VIRGIN_W)) closure->kind = IllegalMove; // non-virgin + if(gameInfo.holdingsSize) { if(board[PieceToNumber(CharToPiece(ToUpper(c)))][BOARD_WIDTH-2] == 0) closure->kind = ImpossibleMove;// must be in stock if(closure->kind == WhiteHSideCastleFR && (closure->ff == BOARD_RGHT-2 || closure->ff == BOARD_RGHT-3)) closure->kind = ImpossibleMove; if(closure->kind == WhiteASideCastleFR && (closure->ff == BOARD_LEFT+2 || closure->ff == BOARD_LEFT+3)) closure->kind = ImpossibleMove; + } } else { - if(closure->rf != BOARD_HEIGHT-1) closure->kind = IllegalMove; - if(!(board[VIRGIN][closure->ff] & VIRGIN_B)) closure->kind = IllegalMove; // non-virgin + if(closure->rf != BOARD_HEIGHT-1-!gameInfo.holdingsSize) closure->kind = IllegalMove; + if(!(board[VIRGIN][closure->ff] & VIRGIN_B)) closure->kind = IllegalMove; // non-virgin + if(gameInfo.holdingsSize) { if(board[BOARD_HEIGHT-1-PieceToNumber(CharToPiece(ToLower(c)))][1] == 0) closure->kind = ImpossibleMove; if(closure->kind == BlackHSideCastleFR && (closure->ff == BOARD_RGHT-2 || closure->ff == BOARD_RGHT-3)) closure->kind = ImpossibleMove; if(closure->kind == BlackASideCastleFR && (closure->ff == BOARD_LEFT+2 || closure->ff == BOARD_LEFT+3)) closure->kind = ImpossibleMove; + } } } else if(gameInfo.variant == VariantChu) {