From 818b549cba5244d042195ef7e6df53789700f497 Mon Sep 17 00:00:00 2001 From: rektdie Date: Fri, 11 Apr 2025 02:43:43 +0200 Subject: [PATCH] encapsulated nodesToGo --- source/search.cpp | 8 +++----- source/search.h | 2 ++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/search.cpp b/source/search.cpp index 34dff4b..b8d8e6b 100644 --- a/source/search.cpp +++ b/source/search.cpp @@ -10,8 +10,6 @@ namespace SEARCH { -U64 nodesToGo = 0; - static inline int timeToSearch = 0; Stopwatch sw; @@ -147,7 +145,7 @@ static SearchResults Quiescence(Board board, int alpha, int beta, int ply, Searc } } } else { - if (ctx.nodes > nodesToGo) { + if (ctx.nodes > ctx.nodesToGo) { StopSearch(); return 0; } @@ -217,7 +215,7 @@ SearchResults PVS(Board board, int depth, int alpha, int beta, int ply, SearchCo } } } else if constexpr (mode == nodesMode) { - if (ctx.nodes > nodesToGo) { + if (ctx.nodes > ctx.nodesToGo) { StopSearch(); return 0; } @@ -468,7 +466,7 @@ SearchResults SearchPosition(Board &board, SearchParams params, SearchContext& c ctx.nodes = 0; if constexpr (mode == nodesMode) { - nodesToGo = params.nodes; + ctx.nodesToGo = params.nodes; } } ctx.pvLine.Clear(); diff --git a/source/search.h b/source/search.h index c1e1c48..3753af3 100644 --- a/source/search.h +++ b/source/search.h @@ -109,6 +109,8 @@ public: class SearchContext { public: U64 nodes = 0; + U64 nodesToGo = 0; + bool doingNullMove = false; PVLine pvLine;