char *MoveToText (int move);
int TimeIsUp (int mode);
+int randomize, ranKey;
+int moveNr; // part of game state; incremented by MakeMove
#define captCode (rawInts + 22*10 + 10)
#define deltaVec (rawChar + 22*10 + 10)
int oldSP = moveSP, *pvStart = pvPtr;
int killer1 = killers[ply][0], killer2 = killers[ply][1], hashMove;
int bestNr, bestScore, startAlpha, startScore, resultDepth, iterDepth=0;
- int hit, hashKeyH;
+ int hit, hashKeyH, ran=0;
int curEval, score;
// legality
int lmr;
search:
lmr = (curMove >= m.late) + (curMove >= m.drops);
+ if(ply==0 && randomize && moveNr < 10) ran = (alpha > INF-100 || alpha <-INF+100 ? 0 : (f.newKey*ranKey>>24 & 31)- 16);
repKey[index] = (int)f.newKey & 0x1FFFFF | f.newEval << 21; // remember position
// recursion
deprec[ply] = (f.checker != CK_NONE ? f.checker : 0)<<24 | maxDepth<<16 | depth<< 8 | iterDepth; path[ply++] = moveStack[curMove];
- score = -Search(stm, -beta, -alpha, &f, iterDepth-1, lmr, highDepth);
+ score = ran - Search(stm, -beta, -alpha+ran, &f, iterDepth-1, lmr, highDepth);
ply--;
repKey[index] = 0;
return bestScore;
}
-int moveNr; // part of game state; incremented by MakeMove
int gameMove[MAXMOVES]; // holds the game history
int stm = WHITE;
// Some global variables that control your engine's behavior
int ponder;
-int randomize;
int resign; // engine-defined option
int contemptFactor; // likewise
index = (unsigned int)undoInfo.newKey >> 24 ^ stm << 2; // uses high byte of low (= hands-free) key
while(repKey[index] && (repKey[index] ^ (int)undoInfo.newKey) & 0x1FFFFF) index += 2; // find empty slot
repKey[index] = (int)undoInfo.newKey & 0x1FFFFF | undoInfo.newEval << 21; // remember position
- stm ^= COLOR;
+ stm ^= COLOR; moveNr++;
return 1;
}
if(!strcmp(command, "memory")) { if(SetMemorySize(atoi(inBuf+7))) printf("tellusererror Not enough memory\n"), exit(-1); return 1; }
if(!strcmp(command, "ping")) { printf("pong%s", inBuf+4); return 1; }
// if(!strcmp(command, "")) { sscanf(inBuf, " %d", &); return 1; }
- if(!strcmp(command, "new")) { engineSide = BLACK; stm = WHITE; maxDepth = MAXPLY; randomize = OFF; return 1; }
+ if(!strcmp(command, "new")) { engineSide = BLACK; stm = WHITE; maxDepth = MAXPLY; randomize = OFF; moveNr = 0; ranKey = GetTickCount() | 0x1001; return 1; }
if(!strcmp(command, "variant")) { GameInit(inBuf + 8); Setup(startPos); return 1; }
if(!strcmp(command, "setboard")){ engineSide = NONE; stm = Setup(inBuf+9); return 1; }
if(!strcmp(command, "undo")) { TakeBack(1); return 1; }