From: H.G.Muller Date: Sun, 11 Feb 2018 11:14:28 +0000 (+0100) Subject: Fix castling through check X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=f889e98412098c0bf11ce0802d254f6efcd7d248;p=crazywa.git Fix castling through check Castling through check, like walking into check, is supposed to be tested through early move generation in the reply node. But this early generation was triggered by testing whether the 'to-piece' was a King, while the way castling is implemented promotes the King to a Rook. This way castling escaped the test. Now early move generation is done based on the from-piece. --- diff --git a/dropper.c b/dropper.c index a2d9e3d..766bfa2 100644 --- a/dropper.c +++ b/dropper.c @@ -1119,7 +1119,7 @@ Search (int stm, int alpha, int beta, StackFrame *ff, int depth, int reduction, int curEval, anaEval, score; // legality - int earlyGen = (ff->toPiece == stm+31); // King was moved + int earlyGen = (ff->fromPiece == stm+31); // King was moved if(ply > 90) { if(DEBUG) Dump("maxply"); ff->depth = 0; return -ff->newEval+150; } f.xking = location[stm+31]; // opponent King, as stm not yet toggled if(!earlyGen && ff->mutation > 0) { // if other piece was moved (not dropped!), abort with +INF score if it was pinned