Don't assume Knight to be always piece number 6
authorH.G.Muller <hgm@hgm-xboard.(none)>
Tue, 10 Apr 2018 15:53:45 +0000 (17:53 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Tue, 10 Apr 2018 16:16:43 +0000 (18:16 +0200)
To determine the number of ranks where dropping is not allowed,
(for pieces that have their drop-limitation flag set in lances[]),
we have to distinguish the Knight. This is now done by assuming that
any piece other than the first two (which are always Pawn and Lance,
even if this requires the Lance to be present as a dummy) is a Knight.

dropper.c

index e7b834c..9d1188e 100644 (file)
--- a/dropper.c
+++ b/dropper.c
@@ -972,7 +972,7 @@ AllDrops (int stm)
        if((signed char)board[from] < -1) { // piece type is in hand
            int r, f, start = 0, end = boardEnd;
            if(mask & 1) { // piece with drop limitation
-               int badZone = (i == 6 ? 44 : 22); // 6 is the Knight in (Judkins) Shogi
+               int badZone = 22 << (i > 1); // if no Pawn or Lance it must be Knight and skip 2 ranks
                if(stm == BLACK || !perpLoses) start = badZone;
                if(stm == WHITE || !perpLoses) end  -= badZone;
            }