From: H.G. Muller Date: Fri, 27 Sep 2013 12:06:47 +0000 (+0200) Subject: Version 0.13: check extension X-Git-Tag: 0.18~27 X-Git-Url: http://winboard.nl/cgi-bin?p=hachu.git;a=commitdiff_plain;h=0740e069182b5fd06a4587612094ccccc27608f8 Version 0.13: check extension --- diff --git a/hachu.c b/hachu.c index 0b2541c..56f1d9f 100644 --- a/hachu.c +++ b/hachu.c @@ -11,7 +11,7 @@ // promotions by pieces with Lion power stepping in & out the zone in same turn // promotion on capture -#define VERSION "0.12n" +#define VERSION "0.13" #define PATH level==0 || path[0] == 0x848f1 && (level==1 /*|| path[1] == 0x3f081 && (level == 2 || path[2] == 0x6f0ac && (level == 3 || path[3] == 0x3e865 && (level == 4 || path[4] == 0x4b865 && (level == 5))))*/) //define PATH 0 @@ -19,6 +19,7 @@ #define HASH #define KILLERS #define NULLMOVE +#define CHECKEXT #define LIONTRAP #define XKINGSAFETY @@ -1715,7 +1716,7 @@ void TerminationCheck(); int Search (int alpha, int beta, int difEval, int depth, int oldPromo, int promoSuppress, int threshold) { - int i, j, k, phase, king, nextVictim, to, defer, autoFail=0; + int i, j, k, phase, king, nextVictim, to, defer, autoFail=0, inCheck = 0, late=INF; int firstMove, oldMSP = msp, curMove, sorted, bad, dubious, bestMoveNr; int resDep, iterDep, ext; int myPV = pvPtr; @@ -1729,12 +1730,20 @@ if(PATH) /*pboard(board),pmap(attacks, BLACK),*/printf("search(%d) {%d,%d} eval= xstm = stm ^ WHITE; //printf("map made\n");fflush(stdout); - // TSUME filter - if(tsume && tsume & stm+1) { + // in-check test and TSUME filter + { k = p[king=royal[stm]].pos; -// if( k == ABSENT) k = p[king + 2].pos; - if( k != ABSENT && !attacks[2*k + xstm]) { - retDep = 60; return INF; // we win when not in check + 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) { // check is possible + if(!attacks[2*k + xstm]) { + if(tsume && tsume & stm+1) { + retDep = 60; return INF; // we win when not in check + } + } +#ifdef CHECKEXT + else if(depth >= QSdepth) inCheck = 1, depth++; +#endif } } @@ -1809,12 +1818,12 @@ if(PATH)printf("new moves, phase=%d\n", phase); switch(phase) { case 0: // null move #ifdef NULLMOVE - if(depth > QSdepth && curEval >= beta) { + if(depth > QSdepth && curEval >= beta && !inCheck) { int nullDep = depth - 3; stm ^= WHITE; score = -Search(-beta, 1-beta, -difEval, nullDep= beta) { msp = oldMSP; retDep += 3; return score + (score < curEval); } + if(score >= beta) { msp = oldMSP; retDep += 3; pvPtr = myPV; return score + (score < curEval); } } #endif if(tenFlag) FireSet(&tb); // in tenjiku we must identify opposing Fire Demons to perform any moves @@ -1883,7 +1892,10 @@ if(PATH) printf("# autofail end (%d-%d)\n", firstMove, msp); for(i=curMove; i