From: H.G. Muller Date: Tue, 10 Jan 2012 14:47:25 +0000 (+0100) Subject: Fix gating on corner squares X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=e86b01cc0e1895b6af910235178344bc898874ef;p=capablanca.git Fix gating on corner squares The test for virginity of the rook would also match opponent castlings! --- 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