From fda407162ca13f9e702aaca8a89e82738a4acc3c Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Wed, 11 Apr 2018 09:25:00 +0200 Subject: [PATCH] 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! --- dropper.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) 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++]; -- 1.7.0.4