Reduce maxDepth
authorH.G.Muller <hgm@hgm-xboard.(none)>
Mon, 15 May 2017 19:45:31 +0000 (21:45 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Mon, 15 May 2017 19:45:31 +0000 (21:45 +0200)
The maximum search depth is now set to MAXPLY-2, to prevent overflow in
arrays with MAXPLY elements.

dropper.c

index 37111d0..4d86e30 100644 (file)
--- a/dropper.c
+++ b/dropper.c
@@ -35,7 +35,7 @@
 #define C_CONTACT 0x00FF
 
 int ply, nodeCount, forceMove, choice, rootMove, lastGameMove, rootScore, abortFlag, postThinking=1; // some frequently used data
-int maxDepth=MAXPLY, timeControl=3000, mps=40, inc, timePerMove, timeLeft=1000; // TC parameters
+int maxDepth=MAXPLY-2, timeControl=3000, mps=40, inc, timePerMove, timeLeft=1000; // TC parameters
 
 #define H_LOWER 1
 #define H_UPPER 2
@@ -1768,7 +1768,7 @@ printf("# command: %s\n", inBuf);
     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; moveNr = 0; ranKey = GetTickCount() | 0x1001; return 1; }
+    if(!strcmp(command, "new"))     { engineSide = BLACK; stm = WHITE; maxDepth = MAXPLY-2; 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; }