diff --git a/source/benchmark.cpp b/source/benchmark.cpp index 2458c17..3739de6 100644 --- a/source/benchmark.cpp +++ b/source/benchmark.cpp @@ -3,6 +3,7 @@ #include "stopwatch.h" #include "tt.h" #include +#include const std::array fenPositions = { "rnbq1k1r/ppp1bppp/4pn2/8/2B5/2NP1N2/PPP2PPP/R1BQR1K1 b - - 2 8", @@ -62,7 +63,12 @@ void RunBenchmark() { int depth = 5; benchStarted = true; searchStopped = false; + + // Clearing TT.Clear(); + std::memset(killerMoves, 0, sizeof(killerMoves)); + std::memset(historyMoves, 0, sizeof(historyMoves)); + nodes = 0; Stopwatch sw; diff --git a/source/search.cpp b/source/search.cpp index 8a4c38f..5b1ffbe 100644 --- a/source/search.cpp +++ b/source/search.cpp @@ -12,11 +12,6 @@ static inline int ply = 0; static inline int timeToSearch = 0; static inline bool doingNullMove = false; -// [id][ply] -static inline int killerMoves[2][64]; -// [stm][from][to] -static inline int historyMoves[2][64][64]; - inline PVLine pvLine; Stopwatch sw; diff --git a/source/search.h b/source/search.h index 8ea4d9e..72eccd1 100644 --- a/source/search.h +++ b/source/search.h @@ -13,6 +13,11 @@ constexpr int inf = 100000; inline bool searchStopped = false; +// [id][ply] +inline int killerMoves[2][64]; +// [stm][from][to] +inline int historyMoves[2][64][64]; + class SearchResults { public: int score = 0; diff --git a/source/uci.cpp b/source/uci.cpp index 21cc81e..da89342 100644 --- a/source/uci.cpp +++ b/source/uci.cpp @@ -1,6 +1,7 @@ #include "uci.h" #include #include +#include #include #include #include "types.h" @@ -112,7 +113,11 @@ void UCILoop(Board &board) { // parse UCI "ucinewgame" command if (input.find("ucinewgame") != std::string::npos) { board.SetByFen(StartingFen); + + // Clearing TT.Clear(); + std::memset(killerMoves, 0, sizeof(killerMoves)); + std::memset(historyMoves, 0, sizeof(historyMoves)); continue; }