Allow entire board to be promotion zone
authorH.G.Muller <hgm@hgm-xboard.(none)>
Tue, 10 Apr 2018 15:59:51 +0000 (17:59 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Tue, 10 Apr 2018 16:16:42 +0000 (18:16 +0200)
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.

dropper.c

index 74e0ea8..9685e96 100644 (file)
--- a/dropper.c
+++ b/dropper.c
@@ -930,7 +930,7 @@ EvasionDrops (int stm, StackFrame *f, int mask)
        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)