#define PATH level==0 || path[0] == 0xc4028 && (level==1 /*|| path[1] == 0x75967 && (level == 2 || path[2] == 0x3400b && (level == 3))*/)\r
//define PATH 0\r
\r
-#define HASH\r
-#define KILLERS\r
-#define NULLMOVE\r
+#define XHASH\r
+#define XKILLERS\r
+#define XNULLMOVE\r
\r
#include <stdio.h>\r
#include <stdlib.h>\r
NewCapture(x, SPECIAL + 8*(i-1&7) + (i+1&7) + victimValue - SORTKEY(attacker), p[attacker].promoFlag);\r
v = kStep[i+1];\r
if((board[x+v] & TYPE) == xstm && board[x+v] > board[sqr])\r
+\r
NewCapture(x, SPECIAL + 8*(i+1&7) + (i-1&7) + victimValue - SORTKEY(attacker), p[attacker].promoFlag);\r
}\r
} else { // primary victim on first ring\r
}\r
#endif\r
\r
- replyDep = (depth < 1 ? depth : iterDep < 1 ? 1 : iterDep);\r
- while(++iterDep <= depth) {\r
+ replyDep = (depth < 1 ? depth-1 : iterDep);\r
+ while(++iterDep <= depth || iterDep == 1) {\r
if(flag && depth>= 0) printf("iter %d:%d\n", depth,iterDep),fflush(stdout);\r
iterAlpha = alpha; bestScore = -INF; bestMoveNr = 0; resDep = 60;\r
for(curMove = firstMove; ; curMove++) { // loop over moves\r
printf("\n");\r
fflush(stdout);\r
}\r
- if(GetTickCount() - startTime > tlim1) break; // do not start iteration we can (most likely) not finish\r
+printf("# s=%d t=%d 1=%d 3=%d f=%d\n",startTime,GetTickCount(),tlim1,tlim3,abortFlag);\r
+ if(!(abortFlag & 1) && GetTickCount() - startTime > tlim1) break; // do not start iteration we can (most likely) not finish\r
}\r
replyDep = iterDep;\r
#ifdef HASH\r
void\r
PonderUntilInput (int stm)\r
{\r
+MapFromScratch(attacks);\r
+ repCnt = 0; abortFlag = -1;\r
+ Search(-INF-1, INF+1, rootEval, maxDepth, sup1, sup2);\r
}\r
\r
int TakeBack(int n)\r
\r
// extract the first word\r
sscanf(inBuf, "%s", command);\r
+printf("# in (mode = %d,%d): %s\n", root, abortFlag, command);\r
if(!strcmp(command, "otim")) { continue; } // do not start pondering after receiving time commands, as move will follow immediately\r
if(!strcmp(command, "time")) { sscanf(inBuf, "time %d", &timeLeft); continue; }\r
if(!strcmp(command, "put")) { ReadSquare(inBuf+4, &lastPut); continue; } // ditto\r
if(!strcmp(command, ".")) { inBuf[0] = 0; return; } // ignore for now\r
if(!strcmp(command, "lift")) { inBuf[0] = 0; Highlight(inBuf+5); return; } // treat here\r
+ abortFlag = 1;\r
return;\r
}\r
}\r
void\r
TerminationCheck()\r
{\r
+ if(abortFlag < 0) { // check for input\r
+ if(InputWaiting()) GetLine(0); // read & examine input command\r
+ } else { // check for time\r
if(GetTickCount() - startTime > tlim3) abortFlag = 2;\r
+ }\r
}\r
\r
main()\r
int i, score, curVarNr;\r
\r
Init(V_CHU); // Chu\r
+ listEnd = 1;\r
\r
while(1) { // infinite loop\r
\r
fflush(stdout); // make sure everything is printed before we do something that might take time\r
+ *inBuf = 0;\r
\r
if(listEnd == 0) ListMoves(); // always maintain a list of legal moves in root position\r
\r
if(stm == engineSide) { // if it is the engine's turn to move, set it thinking, and let it move\r
\r
pboard(board);\r
+ SetSearchTimes(10*timeLeft);\r
score = SearchBestMove(&move, &ponderMove);\r
\r
if(move == INVALID) { // game apparently ended\r
gameMove[moveNr++] = move; // remember game\r
printf("move %s\n", MoveToText(move, 1));\r
listEnd = 0;\r
+ continue;\r
}\r
}\r
\r