]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Clear TableBase mappings in Search::clear()
[stockfish] / src / search.cpp
index c9526ec3c683e38a013089dfcd98bb661f3f2c0e..07680f1d1830e4447c7f61da25be41407bc69510 100644 (file)
@@ -187,6 +187,7 @@ void Search::clear() {
   Time.availableNodes = 0;
   TT.clear();
   Threads.clear();
   Time.availableNodes = 0;
   TT.clear();
   Threads.clear();
+  Tablebases::init(Options["SyzygyPath"]); // Free up mapped files
 }
 
 
 }
 
 
@@ -943,6 +944,12 @@ moves_loop: // When in check, search starts from here
                &&  pos.see_ge(move))
           extension = ONE_PLY;
 
                &&  pos.see_ge(move))
           extension = ONE_PLY;
 
+      // Extension for king moves that change castling rights
+      if (   pos.can_castle(us)
+          && type_of(movedPiece) == KING
+          && depth < 12 * ONE_PLY)
+          extension = ONE_PLY;
+
       // Calculate new depth for this move
       newDepth = depth - ONE_PLY + extension;
 
       // Calculate new depth for this move
       newDepth = depth - ONE_PLY + extension;