From: H.G.Muller Date: Wed, 11 Apr 2018 07:25:00 +0000 (+0200) Subject: Simplify CheckDrops() X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=fda407162ca13f9e702aaca8a89e82738a4acc3c;p=crazywa.git Simplify CheckDrops() CheckDrops() tested half-way the iteration whether it should also try dropping the unpromoted piece, based on the assumption that we must do the Pawn iteration for dropping +P, even if dropping P is forbidden. But in games where +P can be dropped, dropping P (in a place where it checks) can never be forbidden! --- diff --git a/dropper.c b/dropper.c index 6a4ad7e..b4d10fa 100644 --- a/dropper.c +++ b/dropper.c @@ -946,8 +946,8 @@ CheckDrops (int stm, int king) { int i, lowest = 0; if(perpLoses) lowest = !!(pawnCount[sqr2file[king]] & maxBulk[stm]); // in Shogi no Pawn if file already crowded with those - else lowest = (stm == WHITE ? king < 2*22 : king >= 6*22); // in zh no Pawn from back rank - for(i=maxDrop; i>=0; i--) { + else lowest = (stm == WHITE ? king < 2*22 : king >= 6*22); // in zh no Pawn from back rank + for(i=maxDrop; i>=lowest; i--) { // note: in games with promoDrops lowest=0 as Pawns have no bulk there int piece = stm + i, from = handSlot[piece^COLOR]; if((signed char)board[from] < -1) { // piece type is in hand int step, dir; @@ -961,7 +961,6 @@ CheckDrops (int stm, int king) } } } - if(i < lowest) break; // suppresses back-rank Pawn drops in zh dir = 2*firstDir[piece-WHITE]; while((step = steps[dir++])) { int to = king, range = steps[dir++];