diff --git a/src/search.cpp b/src/search.cpp index 542144bf..c09e23d6 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -157,7 +157,6 @@ namespace { EasyMoveManager EasyMove; Value DrawValue[COLOR_NB]; - CounterMoveHistoryStats CounterMoveHistory; template Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth, bool cutNode); @@ -208,13 +207,13 @@ void Search::init() { void Search::clear() { TT.clear(); - CounterMoveHistory.clear(); for (Thread* th : Threads) { th->history.clear(); th->counterMoves.clear(); th->fromTo.clear(); + th->counterMoveHistory.clear(); } Threads.main()->previousScore = VALUE_INFINITE; @@ -807,7 +806,7 @@ namespace { if (pos.legal(move)) { ss->currentMove = move; - ss->counterMoves = &CounterMoveHistory[pos.moved_piece(move)][to_sq(move)]; + ss->counterMoves = &thisThread->counterMoveHistory[pos.moved_piece(move)][to_sq(move)]; pos.do_move(move, st, pos.gives_check(move)); value = -search(pos, ss+1, -rbeta, -rbeta+1, rdepth, !cutNode); pos.undo_move(move); @@ -968,7 +967,7 @@ moves_loop: // When in check search starts from here } ss->currentMove = move; - ss->counterMoves = &CounterMoveHistory[moved_piece][to_sq(move)]; + ss->counterMoves = &thisThread->counterMoveHistory[moved_piece][to_sq(move)]; // Step 14. Make the move pos.do_move(move, st, givesCheck); diff --git a/src/thread.h b/src/thread.h index 8181163e..969fe635 100644 --- a/src/thread.h +++ b/src/thread.h @@ -66,11 +66,12 @@ public: Position rootPos; Search::RootMoves rootMoves; Depth rootDepth; - HistoryStats history; - MoveStats counterMoves; FromToStats fromTo; Depth completedDepth; std::atomic_bool resetCalls; + HistoryStats history; + MoveStats counterMoves; + CounterMoveHistoryStats counterMoveHistory; };