X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=hachu.c;h=87b227f7fe6cf0216024b43ec4f3396ad5942dd8;hb=693edd87cbab139253642d89197b5b2b20dab673;hp=ad1bd2009ec95f345ff8135434595f06e6698d75;hpb=7c7d45009c10aa427b7564e06a1dd52fe74cccb1;p=hachu.git diff --git a/hachu.c b/hachu.c index ad1bd20..87b227f 100644 --- a/hachu.c +++ b/hachu.c @@ -94,7 +94,7 @@ typedef struct { char *array, *reason; int bWidth, bHeight, bsize, zone, currentVariant; int stm, xstm, hashKeyH, hashKeyL, framePtr, msp, nonCapts, rootEval, retMSP, retFirst, retDep, pvPtr, level, cnt50, chuFlag=1, tenFlag, mobilityScore; -int nodes, startTime, tlim1, tlim2, repCnt; +int nodes, startTime, tlim1, tlim2, repCnt, comp; Move retMove, moveStack[10000], path[100], repStack[300], pv[1000], repeatMove[300]; #define X 36 /* slider */ @@ -789,7 +789,8 @@ Init (int var) // piece-square tables for(i=0; i= S && p[attacker].range[i] != J) { // has Knight jump in our direction + if(p[attacker].range[i] <= L && p[attacker].range[i] >= S || p[attacker].range[i] == N) { // has Knight jump in our direction NewCapture(x, sqr + victimValue, p[attacker].promoFlag); // plain jump (as in N) if(p[attacker].range[i] < N) { // Lion power; generate double captures over two possible intermediates int v = kStep[i]; // leftish path @@ -1522,7 +1523,7 @@ if(PATH) /*pboard(board),pmap(attacks, BLACK),*/printf("search(%d) {%d,%d} eval= nodes++; pv[pvPtr++] = 0; // start empty PV, directly behind PV of parent - firstMove = curMove = sorted = msp += 20; // leave 20 empty slots in front of move list + firstMove = curMove = sorted = msp += 50; // leave 50 empty slots in front of move list tb.fireMask = phase = 0; iterDep=1; replyDep = (depth < 1 ? depth : 1) - 1; do { if(flag && depth>= 0) printf("iter %d:%d\n", depth,iterDep),fflush(stdout); @@ -1540,7 +1541,7 @@ if(flag && depth>= 0) printf("phase=%d: first/curr/last = %d / %d / %d\n", phase #if 0 if(curEval >= beta) { stm ^= WHITE; - score = -Search(-beta, -iterAlpha, difEval, depth-3, promoSuppress & SQUARE, ABSENT); + score = -Search(-beta, -iterAlpha, -difEval, depth-3, promoSuppress & SQUARE, ABSENT); stm ^= WHITE; if(score >= beta) { msp = oldMSP; retDep += 3; return score + (score < curEval); } } @@ -1611,7 +1612,7 @@ if(PATH) printf("%d:%2d:%2d msp=%d\n",level,depth,iterDep,msp); // MOVE EXTRACTION extractMove: if(flag & depth >= 0) printf("%2d:%d extract %d/%d\n", depth, iterDep, curMove, msp); - if(curMove < sorted) { + if(curMove > sorted) { move = moveStack[sorted=j=curMove]; for(i=curMove+1; i move) move = moveStack[j=i]; // search move with highest priority @@ -2161,7 +2162,10 @@ printf("var %d\n",i); if(!strcmp(command, "memory")) { SetMemorySize(atoi(inBuf+7)); continue; } if(!strcmp(command, "ping")) { printf("pong%s", inBuf+4); continue; } // if(!strcmp(command, "")) { sscanf(inBuf, " %d", &); continue; } - if(!strcmp(command, "new")) { engineSide = BLACK; Init(V_CHESS); stm = Setup2(DEFAULT_FEN); maxDepth = MAXPLY; randomize = OFF; continue; } + if(!strcmp(command, "new")) { + engineSide = BLACK; Init(V_CHESS); stm = Setup2(DEFAULT_FEN); maxDepth = MAXPLY; randomize = OFF; comp = 0; + continue; + } if(!strcmp(command, "setboard")){ engineSide = NONE; stm = Setup2(inBuf+9); continue; } if(!strcmp(command, "easy")) { ponder = OFF; continue; } if(!strcmp(command, "hard")) { ponder = ON; continue; } @@ -2183,7 +2187,7 @@ printf("var %d\n",i); if(!strcmp(command, "l")) { pplist(); continue; } // ignored commands: if(!strcmp(command, "xboard")) { continue; } - if(!strcmp(command, "computer")){ continue; } + if(!strcmp(command, "computer")){ comp = 1; continue; } if(!strcmp(command, "name")) { continue; } if(!strcmp(command, "ics")) { continue; } if(!strcmp(command, "accepted")){ continue; } @@ -2195,6 +2199,7 @@ printf("var %d\n",i); int move = ParseMove(inBuf+9); if(move == INVALID) { if(reason) printf("Illegal move {%s}\n", reason); else printf("%s\n", reason="Illegal move"); + if(comp) PrintResult(stm, -INF); // against computer: claim } else { stm = MakeMove2(stm, move); ponderMove = INVALID;