From e86b01cc0e1895b6af910235178344bc898874ef Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Tue, 10 Jan 2012 15:47:25 +0100 Subject: [PATCH] Fix gating on corner squares The test for virginity of the rook would also match opponent castlings! --- lasker-2.2.3/src/movecheck.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lasker-2.2.3/src/movecheck.c b/lasker-2.2.3/src/movecheck.c index d575915..e9b3a15 100644 --- a/lasker-2.2.3/src/movecheck.c +++ b/lasker-2.2.3/src/movecheck.c @@ -1710,7 +1710,7 @@ static int move_calculate(struct game_state_t * gs, struct move_t * mt, int prom for (i = g->numHalfMoves-1; i >= 0; i--) { if (g->moveList[i].fromFile == mt->fromFile && g->moveList[i].fromRank == mt->fromRank || g->moveList[i].toFile == mt->fromFile && g->moveList[i].toRank == mt->fromRank || - g->moveList[i].fromFile == ALG_CASTLE && (gs->onMove == WHITE ? 0 : gs->ranks-1) == mt->fromRank && + g->moveList[i].fromFile == ALG_CASTLE && (i&1 ? gs->ranks-1 : 0) == mt->fromRank && (g->moveList[i].fromRank == mt->fromFile || gs->files>>1 == mt->fromFile )) return MOVE_ILLEGAL; } mt->piecePromotionTo = promote; // gating OK -- 1.7.0.4