gameInfo.boardHeight = 8;
gameInfo.holdingsSize = 0;
nrCastlingRights = -1; /* [HGM] Kludge to indicate default should be used */
- for(i=0; i<BOARD_FILES-2; i++)
+ for(i=0; i<BOARD_FILES-6; i++)
initialPosition[CASTLING][i] = initialRights[i] = NoRights; /* but no rights yet */
initialPosition[EP_STATUS] = EP_NONE;
+ initialPosition[TOUCHED_W] = initialPosition[TOUCHED_B] = 0;
SetCharTable(pieceToChar, "PNBRQ...........Kpnbrq...........k");
if(startVariant == gameInfo.variant) // [HGM] nicks: enable nicknames in original variant
SetCharTable(pieceNickName, appData.pieceNickNames);
}
}
+ if(fromY == 0) board[TOUCHED_W] |= 1<<fromX; else // new way to keep track of virginity
+ if(fromY == BOARD_HEIGHT-1) board[TOUCHED_B] |= 1<<fromX;
+ if(toY == 0) board[TOUCHED_W] |= 1<<toX; else
+ if(toY == BOARD_HEIGHT-1) board[TOUCHED_B] |= 1<<toX;
+
for(i=0; i<nrCastlingRights; i++) {
if(board[CASTLING][i] == fromX && castlingRank[i] == fromY ||
board[CASTLING][i] == toX && castlingRank[i] == toY
#define BOARD_RGHT (gameInfo.boardWidth + gameInfo.holdingsWidth)
#define CASTLING (BOARD_RANKS-1) /* [HGM] hide in upper rank */
#define VIRGIN (BOARD_RANKS-2) /* [HGM] pieces not moved */
+#define TOUCHED_W CASTLING][(BOARD_FILES-6) /* [HGM] in upper rank */
+#define TOUCHED_B CASTLING][(BOARD_FILES-5) /* [HGM] in upper rank */
#define EP_RANK CASTLING][(BOARD_FILES-4) /* [HGM] in upper rank */
#define EP_FILE CASTLING][(BOARD_FILES-3) /* [HGM] in upper rank */
#define EP_STATUS CASTLING][(BOARD_FILES-2) /* [HGM] in upper rank */
if(isdigit(*++p)) expo = atoi(p++); // read exponent
if(expo > 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<<f ||
+ r == BOARD_HEIGHT-1 && board[TOUCHED_B] & 1<<f ) ) continue;
if(expo > 1 && dx == 0 && dy == 0) { // castling indicated by O + number
mode |= 16; dy = 1;
}