Merge official-stockfish/master
authorFabian Fichter <ianfab@users.noreply.github.com>
Thu, 3 Sep 2020 22:15:48 +0000 (00:15 +0200)
committerFabian Fichter <ianfab@users.noreply.github.com>
Thu, 3 Sep 2020 22:15:48 +0000 (00:15 +0200)
bench: 4839910

1  2 
Readme.md
src/bitboard.cpp
src/evaluate.cpp
src/position.cpp
src/search.cpp
src/tt.cpp
src/tt.h
src/ucioption.cpp

diff --cc Readme.md
Simple merge
@@@ -156,15 -49,16 +156,16 @@@ namespace 
  
  const std::string Bitboards::pretty(Bitboard b) {
  
 -  std::string s = "+---+---+---+---+---+---+---+---+\n";
 +  std::string s = "+---+---+---+---+---+---+---+---+---+---+---+---+\n";
  
 -  for (Rank r = RANK_8; r >= RANK_1; --r)
 +  for (Rank r = RANK_MAX; r >= RANK_1; --r)
    {
 -      for (File f = FILE_A; f <= FILE_H; ++f)
 +      for (File f = FILE_A; f <= FILE_MAX; ++f)
            s += b & make_square(f, r) ? "| X " : "|   ";
  
-       s += "|\n+---+---+---+---+---+---+---+---+---+---+---+---+\n";
 -      s += "| " + std::to_string(1 + r) + "\n+---+---+---+---+---+---+---+---+\n";
++      s += "| " + std::to_string(1 + r) + "\n+---+---+---+---+---+---+---+---+---+---+---+---+\n";
    }
 -  s += "  a   b   c   d   e   f   g   h\n";
++  s += "  a   b   c   d   e   f   g   h   i   j   k\n";
  
    return s;
  }
@@@ -1104,9 -743,7 +1104,8 @@@ namespace 
                      + 24 * infiltration
                      + 51 * !pos.non_pawn_material()
                      - 43 * almostUnwinnable
-                     -  2 * pos.rule50_count()
                      -110 ;
 +    }
  
      Value mg = mg_value(score);
      Value eg = eg_value(score);
          Trace::add(MOBILITY, mobility[WHITE], mobility[BLACK]);
      }
  
+     // Evaluation grain
+     v = (v / 16) * 16;
      // Side to move point of view
-     return (pos.side_to_move() == WHITE ? v : -v) + Eval::tempo_value(pos);
 -    v = (pos.side_to_move() == WHITE ? v : -v) + Tempo;
++    v = (pos.side_to_move() == WHITE ? v : -v) + Eval::tempo_value(pos);
+     // Damp down the evaluation linearly when shuffling
 -    v = v * (100 - pos.rule50_count()) / 100;
++    if (pos.n_move_rule())
++        v = v * (2 * pos.n_move_rule() - pos.rule50_count()) / (2 * pos.n_move_rule());
+     return v;
    }
  
  } // namespace
@@@ -51,42 -57,18 +51,45 @@@ namespace Zobrist 
  
  std::ostream& operator<<(std::ostream& os, const Position& pos) {
  
 -  os << "\n +---+---+---+---+---+---+---+---+\n";
 +  os << "\n ";
 +  for (File f = FILE_A; f <= pos.max_file(); ++f)
 +      os << "+---";
 +  os << "+\n";
  
 -  for (Rank r = RANK_8; r >= RANK_1; --r)
 +  for (Rank r = pos.max_rank(); r >= RANK_1; --r)
    {
 -      for (File f = FILE_A; f <= FILE_H; ++f)
 -          os << " | " << PieceToChar[pos.piece_on(make_square(f, r))];
 -
 -      os << " | " << (1 + r) << "\n +---+---+---+---+---+---+---+---+\n";
 +      for (File f = FILE_A; f <= pos.max_file(); ++f)
 +          if (pos.unpromoted_piece_on(make_square(f, r)))
 +              os << " |+" << pos.piece_to_char()[pos.unpromoted_piece_on(make_square(f, r))];
 +          else
 +              os << " | " << pos.piece_to_char()[pos.piece_on(make_square(f, r))];
 +
-       os << " |";
++      os << " |" << (1 + r);
 +      if (r == pos.max_rank() || r == RANK_1)
 +      {
 +          Color c = r == RANK_1 ? WHITE : BLACK;
 +          if (c == pos.side_to_move())
 +              os << " *";
 +          else
 +              os << "  ";
 +          if (pos.piece_drops() || pos.seirawan_gating() || pos.arrow_gating())
 +          {
 +              os << " [";
 +              for (PieceType pt = KING; pt >= PAWN; --pt)
 +                  os << std::string(pos.count_in_hand(c, pt), pos.piece_to_char()[make_piece(c, pt)]);
 +              os << "]";
 +          }
 +      }
 +      os << "\n ";
 +      for (File f = FILE_A; f <= pos.max_file(); ++f)
 +          os << "+---";
 +      os << "+\n";
    }
  
 -  os << "   a   b   c   d   e   f   g   h\n"
 -     << "\nFen: " << pos.fen() << "\nKey: " << std::hex << std::uppercase
++  for (File f = FILE_A; f <= pos.max_file(); ++f)
++      os << "   " << char('a' + f);
++  os << "\n";
 +  os << "\nFen: " << pos.fen() << "\nSfen: " << pos.fen(true) << "\nKey: " << std::hex << std::uppercase
       << std::setfill('0') << std::setw(16) << pos.key()
       << std::setfill(' ') << std::dec << "\nCheckers: ";
  
diff --cc src/search.cpp
@@@ -1079,12 -1003,11 +1079,13 @@@ moves_loop: // When in check, search st
                // Futility pruning: parent node (~5 Elo)
                if (   lmrDepth < 6
                    && !ss->inCheck
 -                  && ss->staticEval + 235 + 172 * lmrDepth <= alpha
 -                  &&  (*contHist[0])[movedPiece][to_sq(move)]
 -                    + (*contHist[1])[movedPiece][to_sq(move)]
 -                    + (*contHist[3])[movedPiece][to_sq(move)]
 -                    + (*contHist[5])[movedPiece][to_sq(move)] / 2 < 31400)
 +                  && !(   pos.extinction_value() == -VALUE_MATE
 +                       && pos.extinction_piece_types().find(ALL_PIECES) == pos.extinction_piece_types().end())
 +                  && ss->staticEval + (235 + 172 * lmrDepth) * (1 + pos.check_counting()) <= alpha
 +                  &&  (*contHist[0])[history_slot(movedPiece)][to_sq(move)]
 +                    + (*contHist[1])[history_slot(movedPiece)][to_sq(move)]
-                     + (*contHist[3])[history_slot(movedPiece)][to_sq(move)] < 27400)
++                    + (*contHist[3])[history_slot(movedPiece)][to_sq(move)]
++                    + (*contHist[5])[history_slot(movedPiece)][to_sq(move)] / 2 < 31400)
                    continue;
  
                // Prune moves with negative SEE (~20 Elo)
diff --cc src/tt.cpp
Simple merge
diff --cc src/tt.h
+++ b/src/tt.h
@@@ -65,7 -65,8 +65,8 @@@ private
  
  class TranspositionTable {
  
 -  static constexpr int ClusterSize = 3;
 +  static constexpr int ClusterSize = 5;
+   static constexpr int ClustersPerSuperCluster = 256;
  
    struct Cluster {
      TTEntry entry[ClusterSize];
@@@ -136,13 -56,12 +136,13 @@@ bool CaseInsensitiveLess::operator() (c
  
  void init(OptionsMap& o) {
  
-   // at most 2^32 clusters.
-   constexpr int MaxHashMB = Is64Bit ? 131072 : 2048;
+   // At most 2^32 superclusters. Supercluster = 8 kB
+   constexpr int MaxHashMB = Is64Bit ? 33554432 : 2048;
  
 +  o["Protocol"]              << Option("uci", {"uci", "usi", "ucci", "xboard"});
    o["Debug Log File"]        << Option("", on_logger);
    o["Contempt"]              << Option(24, -100, 100);
 -  o["Analysis Contempt"]     << Option("Both var Off var White var Black var Both", "Both");
 +  o["Analysis Contempt"]     << Option("Both", {"Both", "Off", "White", "Black"});
    o["Threads"]               << Option(1, 1, 512, on_threads);
    o["Hash"]                  << Option(16, 1, MaxHashMB, on_hash_size);
    o["Clear Hash"]            << Option(on_clear_hash);