]> git.sesse.net Git - stockfish/commitdiff
Add continuation history 5
authorVizvezdenec <Vizvezdenec@gmail.com>
Wed, 27 Feb 2019 20:25:12 +0000 (23:25 +0300)
committerMarco Costalba <mcostalba@gmail.com>
Tue, 5 Mar 2019 10:10:10 +0000 (11:10 +0100)
Original patch passed STC:
http://tests.stockfishchess.org/tests/view/5c7439ff0ebc5925cffd3e64
LLR: 2.95 (-2.94,2.94) [0.50,4.50]
Total: 26348 W: 5926 L: 5632 D: 14790

and LTC:
http://tests.stockfishchess.org/tests/view/5c745a8b0ebc5925cffd41a8
LLR: 2.95 (-2.94,2.94) [0.00,3.50]
Total: 198411 W: 33238 L: 32510 D: 132663

But had undefined behavior.
After fixing (thx to @vondele )

passed LTC:
http://tests.stockfishchess.org/tests/view/5c763c7c0ebc5925cffd5de2
LLR: 2.95 (-2.94,2.94) [0.00,3.50]
Total: 112253 W: 18711 L: 18225 D: 75317

bench 3049229

src/movepick.cpp
src/search.cpp

index 87c3f6fa153939bb8da252f1b0b9ed546692b24a..86eb98aa64401d4c32f994d22e67e79c907c5795 100644 (file)
@@ -114,7 +114,8 @@ void MovePicker::score() {
           m.value =  (*mainHistory)[pos.side_to_move()][from_to(m)]
                    + (*continuationHistory[0])[pos.moved_piece(m)][to_sq(m)]
                    + (*continuationHistory[1])[pos.moved_piece(m)][to_sq(m)]
-                   + (*continuationHistory[3])[pos.moved_piece(m)][to_sq(m)];
+                   + (*continuationHistory[3])[pos.moved_piece(m)][to_sq(m)]
+                   + (*continuationHistory[5])[pos.moved_piece(m)][to_sq(m)] / 2;
 
       else // Type == EVASIONS
       {
index d3f1335bdb06292e2fff341a98ba1ee9c8edafad..e75d085b08051f7082d3d76fb8ec670bf01125fb 100644 (file)
@@ -301,7 +301,7 @@ void Thread::search() {
   // The former is needed to allow update_continuation_histories(ss-1, ...),
   // which accesses its argument at ss-4, also near the root.
   // The latter is needed for statScores and killer initialization.
-  Stack stack[MAX_PLY+8], *ss = stack+5;
+  Stack stack[MAX_PLY+10], *ss = stack+7;
   Move  pv[MAX_PLY+1];
   Value bestValue, alpha, beta, delta;
   Move  lastBestMove = MOVE_NONE;
@@ -311,8 +311,8 @@ void Thread::search() {
   Color us = rootPos.side_to_move();
   bool failedLow;
 
-  std::memset(ss-5, 0, 8 * sizeof(Stack));
-  for (int i = 5; i > 0; i--)
+  std::memset(ss-7, 0, 10 * sizeof(Stack));
+  for (int i = 7; i > 0; i--)
      (ss-i)->continuationHistory = &this->continuationHistory[NO_PIECE][0]; // Use as sentinel
   ss->pv = pv;
 
@@ -869,7 +869,9 @@ namespace {
 
 moves_loop: // When in check, search starts from here
 
-    const PieceToHistory* contHist[] = { (ss-1)->continuationHistory, (ss-2)->continuationHistory, nullptr, (ss-4)->continuationHistory };
+    const PieceToHistory* contHist[] = { (ss-1)->continuationHistory, (ss-2)->continuationHistory,
+                                          nullptr, (ss-4)->continuationHistory,
+                                          nullptr, (ss-6)->continuationHistory };
     Move countermove = thisThread->counterMoves[pos.piece_on(prevSq)][prevSq];
 
     MovePicker mp(pos, ttMove, depth, &thisThread->mainHistory,
@@ -1320,7 +1322,9 @@ moves_loop: // When in check, search starts from here
         futilityBase = bestValue + 128;
     }
 
-    const PieceToHistory* contHist[] = { (ss-1)->continuationHistory, (ss-2)->continuationHistory, nullptr, (ss-4)->continuationHistory };
+    const PieceToHistory* contHist[] = { (ss-1)->continuationHistory, (ss-2)->continuationHistory,
+                                          nullptr, (ss-4)->continuationHistory,
+                                          nullptr, (ss-6)->continuationHistory };
 
     // Initialize a MovePicker object for the current position, and prepare
     // to search the moves. Because the depth is <= 0 here, only captures,
@@ -1470,7 +1474,7 @@ moves_loop: // When in check, search starts from here
 
   void update_continuation_histories(Stack* ss, Piece pc, Square to, int bonus) {
 
-    for (int i : {1, 2, 4})
+    for (int i : {1, 2, 4, 6})
         if (is_ok((ss-i)->currentMove))
             (*(ss-i)->continuationHistory)[pc][to] << bonus;
   }