From: H.G.Muller Date: Mon, 2 Jun 2014 17:55:02 +0000 (+0200) Subject: Fix tsume condition when both K and CP present X-Git-Url: http://winboard.nl/cgi-bin?p=hachu.git;a=commitdiff_plain;h=25f905105a3da8d8be0908c40f46f1119dd2ef06 Fix tsume condition when both K and CP present A position where the side-to-be-mated has both K and CP is never a check, and should thus not be allowed to occur in a tsume problem. This was not properly detected. (Strictly speaking it can be a check if both can be captured on the same move by a Lion/Falcon/Eagle, but for now we ignore that.) --- diff --git a/hachu.c b/hachu.c index 9b98aa7..ffde08b 100644 --- a/hachu.c +++ b/hachu.c @@ -1796,7 +1796,12 @@ if(PATH) /*pboard(board),pmap(attacks, BLACK),*/printf("search(%d) {%d,%d} eval= 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... + } else if(p[king + 2].pos != ABSENT) { + if(tsume && tsume & stm+1) { + retDep = 60; return INF; // we win when not in check + } + k = ABSENT; // two kings is no king... + } if( k != ABSENT) { // check is possible if(!attacks[2*k + xstm]) { if(tsume && tsume & stm+1) {