From 195a7bf5f5a9cad6d1908fa3aabc9ca62792e271 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Thu, 9 Oct 2025 16:04:00 +0200 Subject: [PATCH] Fix last-rank Pawn promotion 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 | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hachu.c b/hachu.c index a244701..34f61c5 100644 --- a/hachu.c +++ b/hachu.c @@ -1203,8 +1203,9 @@ inline int NewNonCapture (int x, int y, int promoFlags) { if(board[y] != EMPTY) return 1; // edge, capture or own piece -//if(flag) printf("# add %c%d%c%d, pf=%d\n", x%BW+'a',x/BW,y%BW+'a',y/BW, promoFlags); - if( (entryProm ? promoBoard[y] & ~promoBoard[x] & CAN_PROMOTE +//if(flag) +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]); + if( (entryProm ? promoBoard[y] & (~promoBoard[x] & CAN_PROMOTE | LAST_RANK) : promoBoard[y] | promoBoard[x] ) & promoFlags ){ // piece can promote with this move moveStack[msp++] = moveStack[nonCapts]; // create space for promotion moveStack[nonCapts++] = x<