]> git.sesse.net Git - stockfish/commitdiff
Allow negative history values
authorMarco Costalba <mcostalba@gmail.com>
Tue, 12 Jan 2010 17:21:15 +0000 (18:21 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Wed, 13 Jan 2010 21:10:43 +0000 (22:10 +0100)
Don't clamp to zero if a move continues to fail.

After 946 games at 1+0
Mod vs Orig +208 =562 -176 +12 ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/history.cpp

index 3cda37061d6d55a201413736323d927b24514158..22116412c863c4e0a5efadbed4abf61931eb7e2b 100644 (file)
@@ -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;
 }