From: H.G.Muller Date: Wed, 24 Sep 2014 15:02:37 +0000 (+0200) Subject: Improve virginity test for engine-defined pieces X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=211b194243de81ed013566a30ef754018586c4e1;p=xboard.git Improve virginity test for engine-defined pieces Two squares in the board are now reserved for flags that indicate whether back-rank pieces have been touched. This allows MovesFromString() to accurately test virginity of these pieces, rather than having to assume it when the piece matches that in the opening position. For other ranks the latter test is still used, as these are normally (irreversible) Pawns, which cannot return there (and in drop games, when they would, would again be considered virgin enough for the purpose of double-pushing!). --- diff --git a/backend.c b/backend.c index 758b71a..749bac9 100644 --- a/backend.c +++ b/backend.c @@ -6028,9 +6028,10 @@ InitPosition (int redraw) gameInfo.boardHeight = 8; gameInfo.holdingsSize = 0; nrCastlingRights = -1; /* [HGM] Kludge to indicate default should be used */ - for(i=0; i 9) p++; // allow double-digit desc = p; // this is start of next move - if(initial && board[r][f] != initialPosition[r][f]) continue; + if(initial && (board[r][f] != initialPosition[r][f] || + r == 0 && board[TOUCHED_W] & 1< 1 && dx == 0 && dy == 0) { // castling indicated by O + number mode |= 16; dy = 1; }