From e5b8f1899abb2cc0f406df1a6f22b5c605c58363 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Tue, 7 Oct 2025 21:44:30 +0200 Subject: [PATCH] Fix counterstike against promoting Kirin The ban on capturing Lion by non-Lion nonly applies to a Lion elsewhere, never to recapturing a Kirin that captured a Lion and promoted in the process. This exemption is now implemented by passing the capture square in promoSuppress for Ky x Ln+, and testing that on a subsequent other x Ln. This is harmless, as +Ky cannot promote anyway. --- hachu.c | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/hachu.c b/hachu.c index 430af97..6ab5442 100644 --- a/hachu.c +++ b/hachu.c @@ -10,7 +10,7 @@ // promotions by pieces with Lion power stepping in & out the zone in same turn // promotion on capture -#define VERSION "0.21" +#define VERSION "0.21d" //define PATH level==0 || path[0] == 0x82906b && (level==1 || path[1] == 0x8790d9 && (level == 2 || path[2] == 0x8598ca && (level == 3 /*|| path[3] == 0x3e865 && (level == 4 || path[4] == 0x4b865 && (level == 5))*/))) #define PATH 0 @@ -377,6 +377,7 @@ PieceDesc makaPieces[] = { {"fY", "", 10, { 0,X,0,0,X,0,0,X } }, // Free Tile +Y {"fU", "", 10, { 0,X,0,0,0,0,0,X } }, // Free Stone +U {"EM", "", 10, { 0,0,0,0,0,0,0,0 } }, // Emperor +K + {"TK", "", 1300, { K,K,K,K,K,K,K,K }, 0, 6}, // Teaching King +I' {"BS", "", 1500, { S,S,S,S,S,S,S,S }, 0, 7}, // Budhist Spirit +J' {"WS", "", 10, { X,X,0,X,1,X,0,X } }, // Wizard Stork +N' @@ -2311,9 +2312,12 @@ MapFromScratch(attacks); // for as long as incremental update does not work. if(dist[tb.from-tb.to] != 1 && attacks[2*tb.to + stm] && p[tb.epVictim[0]].value <= 50) score = -INF; // our Lion is indeed made vulnerable and can be recaptured } else { // other x Ln - if(promoSuppress & PROMOTE) { // non-Lion captures Lion after opponent did same + if(promoSuppress & PROMOTE && // previous move was also other x Lion + (promoSuppress & SQUARE) != tb.to) { // but not made by a promoting Kirin if(!okazaki || attacks[2*tb.to + stm]) score = -INF; } + if(p[board[tb.to]].value == LVAL) // the capturer promoted to Lion (and must have been a Kirin) + defer = tb.to; // exempt it from the counter-strike rule defer |= PROMOTE; // if we started, flag he cannot do it in reply } if(score == -INF) { @@ -2541,7 +2545,10 @@ MakeMove2 (int stm, MOVE move) FireSet(&undoInfo); sup0 = sup1; sup1 = sup2; sup2 = MakeMove(move, &undoInfo); - if(chuFlag && p[undoInfo.victim].value == LVAL && p[undoInfo.piece].value != LVAL) sup2 |= PROMOTE; + if(chuFlag && p[undoInfo.victim].value == LVAL && p[undoInfo.piece].value != LVAL) { + if(p[board[undoInfo.to]].value == LVAL) sup2 = undoInfo.to; + sup2 |= PROMOTE; + } rootEval = -rootEval - undoInfo.booty; for(i=0; i<200; i++) repStack[i] = repStack[i+1], checkStack[i] = checkStack[i+1]; -- 1.7.0.4