]> git.sesse.net Git - stockfish/commitdiff
Store static value and king danger in TT also in TT.insert_pv() method
authorJoona Kiiski <joona.kiiski@gmail.com>
Sun, 18 Jul 2010 21:19:09 +0000 (00:19 +0300)
committerMarco Costalba <mcostalba@gmail.com>
Tue, 20 Jul 2010 18:01:01 +0000 (19:01 +0100)
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/tt.cpp

index bc26606721413eb90ecae8923c7d4238960892d2..d2f983c9f014cba76d250092a8f0e9f06c60dc04 100644 (file)
@@ -25,6 +25,7 @@
 #include <cassert>
 #include <cstring>
 
+#include "evaluate.h"
 #include "movegen.h"
 #include "tt.h"
 
@@ -164,13 +165,18 @@ void TranspositionTable::new_search() {
 void TranspositionTable::insert_pv(const Position& pos, Move pv[]) {
 
   StateInfo st;
+  EvalInfo ei;
+  Value v;
   Position p(pos, pos.thread());
 
   for (int i = 0; pv[i] != MOVE_NONE; i++)
   {
       TTEntry *tte = retrieve(p.get_key());
       if (!tte || tte->move() != pv[i])
-          store(p.get_key(), VALUE_NONE, VALUE_TYPE_NONE, Depth(-127*OnePly), pv[i], VALUE_NONE, VALUE_NONE);
+      {
+          v = (p.is_check() ? VALUE_NONE : evaluate(p, ei));
+          store(p.get_key(), VALUE_NONE, VALUE_TYPE_NONE, Depth(-127*OnePly), pv[i], v, ei.kingDanger[pos.side_to_move()]);
+      }
       p.do_move(pv[i], st);
   }
 }