encapsulated nodesToGo

This commit is contained in:
rektdie committed 2025-04-11 02:43:43 +02:00
1 parent 48b8934861
commit 818b549cba
2 files changed
+5 -5

No files matched your search

+3 -5
View File
@@ -10,8 +10,6 @@
namespace SEARCH { namespace SEARCH {
U64 nodesToGo = 0;
static inline int timeToSearch = 0; static inline int timeToSearch = 0;
Stopwatch sw; Stopwatch sw;
@@ -147,7 +145,7 @@ static SearchResults Quiescence(Board board, int alpha, int beta, int ply, Searc
} }
} }
} else { } else {
if (ctx.nodes > nodesToGo) { if (ctx.nodes > ctx.nodesToGo) {
StopSearch(); StopSearch();
return 0; return 0;
} }
@@ -217,7 +215,7 @@ SearchResults PVS(Board board, int depth, int alpha, int beta, int ply, SearchCo
} }
} }
} else if constexpr (mode == nodesMode) { } else if constexpr (mode == nodesMode) {
if (ctx.nodes > nodesToGo) { if (ctx.nodes > ctx.nodesToGo) {
StopSearch(); StopSearch();
return 0; return 0;
} }
@@ -468,7 +466,7 @@ SearchResults SearchPosition(Board &board, SearchParams params, SearchContext& c
ctx.nodes = 0; ctx.nodes = 0;
if constexpr (mode == nodesMode) { if constexpr (mode == nodesMode) {
nodesToGo = params.nodes; ctx.nodesToGo = params.nodes;
} }
} }
ctx.pvLine.Clear(); ctx.pvLine.Clear();
+2
View File
@@ -109,6 +109,8 @@ public:
class SearchContext { class SearchContext {
public: public:
U64 nodes = 0; U64 nodes = 0;
U64 nodesToGo = 0;
bool doingNullMove = false; bool doingNullMove = false;
PVLine pvLine; PVLine pvLine;