\r
#define VERSION 0.0\r
\r
-#define PATH level==0 || level==1 && path[0] == 0x55893\r
+//define PATH level==0 || level==1 && path[0] == 0x55893\r
+#define PATH 0\r
\r
#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <string.h>\r
+#include <signal.h>\r
+#include <time.h>\r
+\r
+#ifdef WIN32 \r
+# include <windows.h>\r
+#else\r
+# include <sys/time.h>\r
+ int GetTickCount() // with thanks to Tord\r
+ { struct timeval t;\r
+ gettimeofday(&t, NULL);\r
+ return t.tv_sec*1000 + t.tv_usec/1000;\r
+ }\r
+#endif\r
\r
#define BW 24\r
#define BH 12\r
} UndoInfo;\r
\r
int stm, xstm, hashKeyH, hashKeyL, framePtr, msp, nonCapts, retMSP, retFirst, level, chuFlag=1;\r
+int nodes, startTime, tlim1, tlim2;\r
Move retMove, moveStack[10000], path[100];\r
\r
#define X 36 /* slider */\r
#endif\r
} // next move\r
cutoff:\r
+ if(!level) { // root node\r
+ if(GetTickCount() - startTime > tlim1) break; // do not start iteration we can (most likely) not finish\r
+ }\r
replyDep = iterDep;\r
} while(++iterDep <= depth); // next depth\r
retMSP = msp;\r
int\r
SearchBestMove (int stm, int timeLeft, int mps, int timeControl, int inc, int timePerMove, MOVE *move, MOVE *ponderMove)\r
{\r
- int score;\r
+ int score, targetTime, movesLeft = 50;\r
+ if(mps) movesLeft = mps - (moveNr>>1)%mps;\r
+ targetTime = timeLeft*10 / (movesLeft + 1) + 1000 * inc;\r
+ if(timePerMove > 0) targetTime = timeLeft * 5;\r
+ startTime = GetTickCount();\r
+ tlim1 = 0.3*targetTime;\r
+ tlim2 = 1.9*targetTime;\r
+ nodes = 0;\r
MapFromScratch(attacks);\r
- score = Search(-INF-1, INF+1, 0, 3, sup1, sup2);\r
+ score = Search(-INF-1, INF+1, 0, 20, sup1, sup2);\r
*move = retMove;\r
*ponderMove = INVALID;\r
return score;\r