]> git.sesse.net Git - stockfish/blobdiff - src/history.cpp
Remove pointless gcc flag when generating dependencies
[stockfish] / src / history.cpp
index 949ba316420d8dc5351e412e32f1e23b414b261a..22116412c863c4e0a5efadbed4abf61931eb7e2b 100644 (file)
@@ -61,7 +61,7 @@ void History::success(Piece p, Square to, Depth d) {
   if (history[p][to] >= HistoryMax)
       for (int i = 0; i < 16; i++)
           for (int j = 0; j < 64; j++)
-              history[i][j] /= 4;
+              history[i][j] /= 2;
 }
 
 
@@ -75,8 +75,12 @@ void History::failure(Piece p, Square to, Depth d) {
   assert(square_is_ok(to));
 
   history[p][to] -= int(d) * int(d);
-  if (history[p][to] < 0)
-      history[p][to] = 0;
+
+  // Prevent history underflow
+  if (history[p][to] <= -HistoryMax)
+      for (int i = 0; i < 16; i++)
+          for (int j = 0; j < 64; j++)
+              history[i][j] /= 2;
 }