The test for determining whether a drop on first or last rank is actually
a drop on first rank (so it would not be subject to restrictions in Shogi)
was not working if the entire board was the promotion zone, as it was based
on being outside the zone for the applicable color. A test directly based
on the square number ow fixes that.
if((mask >>= 1) & 1) continue; // suppress 'futile interpositions'
i = zoneTab[x] & Z_LAST; // Pawn not on first & last rank (OK for zh)
if(perpLoses) { // but it is Shogi!
- if(!(zoneTab[x] & stm)) i = 0; // outside zone, so dropping is always allowed
+ if(x<22 ^ stm==BLACK) i = 0; // pawn drops allowed on 1st rank for white and elsewhere for black
else if(perpLoses < TORI_NR) { // Shogi variant with Lance
i *= 2; // no Pawn, then also no Lance!
last -= (zoneTab[x] & (Z_2ND & ~COLOR)) > knightLim; // on last 2 ranks trim off Knight (not in Wa)