Merge official-stockfish/master
authorFabian Fichter <ianfab@users.noreply.github.com>
Sat, 9 Feb 2019 17:13:35 +0000 (18:13 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sat, 9 Feb 2019 17:13:35 +0000 (18:13 +0100)
bench: 4633927

1  2 
src/evaluate.cpp
src/search.cpp
src/tt.cpp
src/tt.h

@@@ -664,13 -551,13 +661,13 @@@ namespace 
          {
              Square s = pop_lsb(&b);
              score += ThreatByRook[type_of(pos.piece_on(s))];
 -            if (type_of(pos.piece_on(s)) != PAWN)
 -                score += ThreatByRank * (int)relative_rank(Them, s);
 +            if (type_of(pos.piece_on(s)) != PAWN && type_of(pos.piece_on(s)) != SHOGI_PAWN)
 +                score += ThreatByRank * (int)relative_rank(Them, s, pos.max_rank());
          }
  
-         b = weak & attackedBy[Us][KING];
-         if (b)
-             score += ThreatByKing[more_than_one(b)];
+         // Bonus for king attacks on pawns or pieces which are not pawn-defended
+         if (weak & attackedBy[Us][KING])
+             score += ThreatByKing;
  
          score += Hanging * popcount(weak & ~attackedBy[Them][ALL_PIECES]);
  
diff --cc src/search.cpp
@@@ -713,10 -708,10 +713,10 @@@ namespace 
      {
          ss->staticEval = eval =
          (ss-1)->currentMove != MOVE_NULL ? evaluate(pos)
 -                                         : -(ss-1)->staticEval + 2 * Eval::Tempo;
 +                                         : -(ss-1)->staticEval + 2 * Eval::tempo_value(pos);
  
          tte->save(posKey, VALUE_NONE, BOUND_NONE, DEPTH_NONE, MOVE_NONE,
-                   ss->staticEval, TT.generation());
+                   ss->staticEval);
      }
  
      // Step 7. Razoring (~2 Elo)
diff --cc src/tt.cpp
  
  TranspositionTable TT; // Our global transposition table
  
+ /// TTEntry::save saves a TTEntry
+ void TTEntry::save(Key k, Value v, Bound b, Depth d, Move m, Value ev) {
+   assert(d / ONE_PLY * ONE_PLY == d);
+   // Preserve any existing move for the same position
+   if (m || (k >> 48) != key16)
 -      move16 = (uint16_t)m;
++      move32 = (uint32_t)m;
+   // Overwrite less valuable entries
+   if (  (k >> 48) != key16
+       || d / ONE_PLY > depth8 - 4
+       || b == BOUND_EXACT)
+   {
+       key16     = (uint16_t)(k >> 48);
+       value16   = (int16_t)v;
+       eval16    = (int16_t)ev;
+       genBound8 = (uint8_t)(TT.generation8 | b);
+       depth8    = (int8_t)(d / ONE_PLY);
+   }
+ }
  
  /// TranspositionTable::resize() sets the size of the transposition table,
  /// measured in megabytes. Transposition table consists of a power of 2 number
diff --cc src/tt.h
Simple merge