int ply, nodeCount, forceMove, choice, rootMove, lastGameMove, rootScore, abortFlag, postThinking=1; // some frequently used data
int maxDepth=MAXPLY-2, timeControl=3000, mps=40, inc, timePerMove, timeLeft=1000; // TC parameters
-int rootFirst, rootCurrent, rootLast, rootPly;
+int rootFirst, rootCurrent, rootLast, rootPly, margin;
#define H_LOWER 1
#define H_UPPER 2
if(f.depth < resultDepth) resultDepth = f.depth;
if(f.lim > upperScore) upperScore = f.lim;
- if(score > bestScore) {
- bestScore = score;
- if(score > alpha) {
+ if(score > bestScore) bestScore = score, bestNr = curMove;
+ if(score > alpha) {
int *tail;
- alpha = score; bestNr = curMove;
+ alpha = score;
history[moveStack[curMove] & 0xFFFF] += iterDepth*iterDepth;
if(score > INF-100 && curMove >= m.nonCapts)
mateKillers[(ff->wholeMove & 0xFFFF) + (stm - WHITE << 11)] = moveStack[curMove] & 0xFFFF | f.xking << 16 | board[f.toSqr] << 24; // store mate killers
for(tail=pvStart; *tail; tail++) printf(" %s", MoveToText(*tail));
printf("\n"); fflush(stdout);
ff->move = moveStack[bestNr];
+ alpha = bestScore - margin;
}
- }
}
if(ply == 0) rootFirst = m.firstMove, rootLast = moveSP, rootCurrent = curMove, rootPly = iterDepth;
} // move loop
if(!strcmp(command, "option")) { // setting of engine-define option; find out which
if(sscanf(inBuf+7, "Resign=%d", &resign) == 1) return 0;
if(sscanf(inBuf+7, "Contempt=%d", &contemptFactor) == 1) return 0;
- return 1;
}
if(searching) {
"5x5+4_shogi,5x5+5_shogi,6x6+6_shogi,7x7+6_shogi,11x17+16_chu\"\n");
printf("feature option=\"Resign -check 0\"\n"); // example of an engine-defined option
printf("feature option=\"Contempt -spin 0 -200 200\"\n"); // and another one
+ printf("feature option=\"Multi-PV margin -spin 0 0 10000\"\n");
printf("feature done=1\n");
return 1;
}
+ if(!strcmp(command, "option")) { // engine-defined options that must abort search
+ if(sscanf(inBuf+7, "Multi-PV margin=%d", &margin) == 1) return 1;
+ return 1;
+ }
if(!strcmp(command, "sd")) { sscanf(inBuf+2, "%d", &maxDepth); return 1; }
if(!strcmp(command, "st")) { sscanf(inBuf+2, "%d", &timePerMove); return 1; }
if(!strcmp(command, "memory")) { if(SetMemorySize(atoi(inBuf+7))) printf("tellusererror Not enough memory\n"), exit(-1); return 1; }