From: H.G.Muller Date: Wed, 30 Apr 2014 08:10:22 +0000 (+0200) Subject: Fix double-capture of royal pair X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=f7a615f1a96b20936398a09e1040bbef9172b03e;p=hachu.git Fix double-capture of royal pair Kings could step in check if there was a Crown Prince, but there was no allowance for the fact that this could expose both of them to simultaneous capture by a Lion. So the search can visit nodes where there is no royal, which did cause a cratch. This is now intercepted at the top of Search, in the check test, which aborts the branch if there is no royal. Except in tsume for the winning side. (Although this then might still cause the crash, probably in eval.) --- diff --git a/hachu.c b/hachu.c index 641de3b..869a9b8 100644 --- a/hachu.c +++ b/hachu.c @@ -12,7 +12,7 @@ #define VERSION "0.19" -//define PATH level==0/* || path[0] == 0x1103a && (level==1 || path[1] == 0x6f0f6 && (level == 2 /*|| path[2] == 0x8710f && (level == 3 /*|| path[3] == 0x3e865 && (level == 4 || path[4] == 0x4b865 && (level == 5)))))*/ +//define PATH level==0 || path[0] == 0x590cb && (level==1 || path[1] == 0x4c0c9 && (level == 2 || path[2] == 0x8598ca && (level == 3 /*|| path[3] == 0x3e865 && (level == 4 || path[4] == 0x4b865 && (level == 5))*/))) #define PATH 0 #define HASH @@ -1787,8 +1787,10 @@ if(PATH) /*pboard(board),pmap(attacks, BLACK),*/printf("search(%d) {%d,%d} eval= // in-check test and TSUME filter { k = p[king=royal[stm]].pos; - if( k == ABSENT) k = p[king + 2].pos; - else if(p[king + 2].pos != ABSENT) k = ABSENT; // two kings is no king... + if( k == ABSENT) { + if((k = p[king + 2].pos) == ABSENT && (!tsume || tsume & stm+1)) + return -INF; // lose when no King (in tsume only for side to be mated) + } else if(p[king + 2].pos != ABSENT) k = ABSENT; // two kings is no king... if( k != ABSENT) { // check is possible if(!attacks[2*k + xstm]) { if(tsume && tsume & stm+1) {