From 211b194243de81ed013566a30ef754018586c4e1 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Wed, 24 Sep 2014 17:02:37 +0200 Subject: [PATCH] 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!). --- backend.c | 8 +++++++- common.h | 2 ++ moves.c | 4 +++- 3 files changed, 12 insertions(+), 2 deletions(-) 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; } -- 1.7.0.4