X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fsearch.cpp;h=85d702c4d4c410e0eb4e5eb045977c6d891e5114;hb=83a574ff271ec5924976b48cf65ac62278f87558;hp=06546f99d038d7942162de2a2bf3d60eeeab3d9a;hpb=40f5abba104b411ec5234e2c93b05bba8e6bd3c8;p=stockfish diff --git a/src/search.cpp b/src/search.cpp index 06546f99..85d702c4 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -25,11 +25,11 @@ #include #include -#include "book.h" #include "evaluate.h" #include "movegen.h" #include "movepick.h" #include "notation.h" +#include "rkiss.h" #include "search.h" #include "timeman.h" #include "thread.h" @@ -42,6 +42,7 @@ namespace Search { LimitsType Limits; std::vector RootMoves; Position RootPos; + Color RootColor; Time::point SearchTime; StateStackPtr SetupStates; } @@ -179,13 +180,12 @@ uint64_t Search::perft(Position& pos, Depth depth) { void Search::think() { - static PolyglotBook book; // Defined static to initialize the PRNG only once - - TimeMgr.init(Limits, RootPos.game_ply(), RootPos.side_to_move()); + RootColor = RootPos.side_to_move(); + TimeMgr.init(Limits, RootPos.game_ply(), RootColor); int cf = Options["Contempt Factor"] * PawnValueEg / 100; // From centipawns - DrawValue[ RootPos.side_to_move()] = VALUE_DRAW - Value(cf); - DrawValue[~RootPos.side_to_move()] = VALUE_DRAW + Value(cf); + DrawValue[ RootColor] = VALUE_DRAW - Value(cf); + DrawValue[~RootColor] = VALUE_DRAW + Value(cf); if (RootMoves.empty()) { @@ -197,25 +197,14 @@ void Search::think() { goto finalize; } - if (Options["OwnBook"] && !Limits.infinite && !Limits.mate) - { - Move bookMove = book.probe(RootPos, Options["Book File"], Options["Best Book Move"]); - - if (bookMove && std::count(RootMoves.begin(), RootMoves.end(), bookMove)) - { - std::swap(RootMoves[0], *std::find(RootMoves.begin(), RootMoves.end(), bookMove)); - goto finalize; - } - } - if (Options["Write Search Log"]) { Log log(Options["Search Log Filename"]); log << "\nSearching: " << RootPos.fen() << "\ninfinite: " << Limits.infinite << " ponder: " << Limits.ponder - << " time: " << Limits.time[RootPos.side_to_move()] - << " increment: " << Limits.inc[RootPos.side_to_move()] + << " time: " << Limits.time[RootColor] + << " increment: " << Limits.inc[RootColor] << " moves to go: " << Limits.movestogo << "\n" << std::endl; } @@ -879,6 +868,12 @@ moves_loop: // When in check and at SpNode search starts from here if (move == countermoves[0] || move == countermoves[1]) ss->reduction = std::max(DEPTH_ZERO, ss->reduction - ONE_PLY); + // Decrease reduction for moves that escape a capture + if ( ss->reduction + && type_of(pos.piece_on(to_sq(move))) != PAWN + && pos.see_sign(make_move(to_sq(move), from_sq(move))) < 0) + ss->reduction = std::max(DEPTH_ZERO, ss->reduction - ONE_PLY); + Depth d = std::max(newDepth - ss->reduction, ONE_PLY); if (SpNode) alpha = splitPoint->alpha;