Fix last-rank Pawn promotion public
authorH.G.Muller <hgm@hgm-xboard.(none)>
Thu, 9 Oct 2025 14:04:00 +0000 (16:04 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Thu, 9 Oct 2025 14:04:00 +0000 (16:04 +0200)
With "Promote on entry" on, Pawns were not allowed to promote on last rank
in Chu Shogi. Undesired side effect of this fix is that Lances now also
are allowed to do that (subject to a 1-turn delay).

hachu.c

diff --git a/hachu.c b/hachu.c
index a244701..34f61c5 100644 (file)
--- a/hachu.c
+++ b/hachu.c
@@ -1203,8 +1203,9 @@ inline int
 NewNonCapture (int x, int y, int promoFlags)\r
 {\r
   if(board[y] != EMPTY) return 1; // edge, capture or own piece\r
-//if(flag) printf("# add %c%d%c%d, pf=%d\n", x%BW+'a',x/BW,y%BW+'a',y/BW, promoFlags);\r
-  if( (entryProm ? promoBoard[y] & ~promoBoard[x] & CAN_PROMOTE\r
+//if(flag) \r
+printf("# add %c%d%c%d, pf=%x %x %x\n", x%BW+'a',x/BW+1,y%BW+'a',y/BW+1, promoFlags, promoBoard[x], promoBoard[y]);\r
+  if( (entryProm ? promoBoard[y] & (~promoBoard[x] & CAN_PROMOTE | LAST_RANK)\r
                  : promoBoard[y] |  promoBoard[x]       ) & promoFlags ){ // piece can promote with this move\r
     moveStack[msp++] = moveStack[nonCapts];           // create space for promotion\r
     moveStack[nonCapts++] = x<<SQLEN | y | PROMOTE;   // push promotion\r