Merge official-stockfish/master
authorFabian Fichter <ianfab@users.noreply.github.com>
Mon, 1 Jun 2020 10:26:06 +0000 (12:26 +0200)
committerFabian Fichter <ianfab@users.noreply.github.com>
Mon, 1 Jun 2020 10:26:06 +0000 (12:26 +0200)
bench: 4964428

1  2 
src/evaluate.cpp
src/movepick.cpp
src/movepick.h
src/search.cpp
src/thread.cpp
src/thread.h

Simple merge
@@@ -116,10 -112,11 +116,11 @@@ void MovePicker::score() 
  
        else if (Type == QUIETS)
            m.value =      (*mainHistory)[pos.side_to_move()][from_to(m)]
 -                   + 2 * (*continuationHistory[0])[pos.moved_piece(m)][to_sq(m)]
 -                   + 2 * (*continuationHistory[1])[pos.moved_piece(m)][to_sq(m)]
 -                   + 2 * (*continuationHistory[3])[pos.moved_piece(m)][to_sq(m)]
 -                   +     (*continuationHistory[5])[pos.moved_piece(m)][to_sq(m)]
 +                   + 2 * (*continuationHistory[0])[history_slot(pos.moved_piece(m))][to_sq(m)]
 +                   + 2 * (*continuationHistory[1])[history_slot(pos.moved_piece(m))][to_sq(m)]
 +                   + 2 * (*continuationHistory[3])[history_slot(pos.moved_piece(m))][to_sq(m)]
-                    +     (*continuationHistory[5])[history_slot(pos.moved_piece(m))][to_sq(m)];
++                   +     (*continuationHistory[5])[history_slot(pos.moved_piece(m))][to_sq(m)]
+                    + (ply < MAX_LPH ?  4 * (*lowPlyHistory)[ply][from_to(m)] : 0);
  
        else // Type == EVASIONS
        {
diff --cc src/movepick.h
@@@ -86,8 -86,14 +86,14 @@@ enum StatsType { NoCaptures, Captures }
  /// unsuccessful during the current search, and is used for reduction and move
  /// ordering decisions. It uses 2 tables (one for each color) indexed by
  /// the move's from and to squares, see www.chessprogramming.org/Butterfly_Boards
 -typedef Stats<int16_t, 10692, COLOR_NB, int(SQUARE_NB) * int(SQUARE_NB)> ButterflyHistory;
 +typedef Stats<int16_t, 10692, COLOR_NB, int(SQUARE_NB + 1) * int(1 << SQUARE_BITS)> ButterflyHistory;
  
+ /// LowPlyHistory at higher depths records successful quiet moves on plies 0 to 3
+ /// and quiet moves which are/were in the PV (ttPv)
+ /// It get cleared with each new search and get filled during iterative deepening
+ constexpr int MAX_LPH = 4;
 -typedef Stats<int16_t, 10692, MAX_LPH, int(SQUARE_NB) * int(SQUARE_NB)> LowPlyHistory;
++typedef Stats<int16_t, 10692, MAX_LPH, int(SQUARE_NB + 1) * int(1 << SQUARE_BITS)> LowPlyHistory;
  /// CounterMoveHistory stores counter moves indexed by [piece][to] of the previous
  /// move, see www.chessprogramming.org/Countermove_Heuristic
  typedef Stats<Move, NOT_USED, PIECE_NB, SQUARE_NB> CounterMoveHistory;
diff --cc src/search.cpp
Simple merge
diff --cc src/thread.cpp
@@@ -210,7 -211,8 +211,8 @@@ void ThreadPool::start_thinking(Positio
        th->nodes = th->tbHits = th->nmpMinPly = 0;
        th->rootDepth = th->completedDepth = 0;
        th->rootMoves = rootMoves;
 -      th->rootPos.set(pos.fen(), pos.is_chess960(), &setupStates->back(), th);
 +      th->rootPos.set(pos.variant(), pos.fen(), pos.is_chess960(), &setupStates->back(), th);
+       th->lowPlyHistory.fill(0);
    }
  
    setupStates->back() = tmp;
diff --cc src/thread.h
Simple merge