From 3f9ad117acf5dd4b85fb5edeb75c76daa537234b Mon Sep 17 00:00:00 2001 From: rektdie Date: Fri, 11 Apr 2025 02:25:05 +0200 Subject: [PATCH] encapsulated doingNullMove --- source/search.cpp | 8 +++----- source/search.h | 1 + 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/source/search.cpp b/source/search.cpp index e651747..444f147 100644 --- a/source/search.cpp +++ b/source/search.cpp @@ -10,11 +10,9 @@ namespace SEARCH { -U64 nodes = 0; U64 nodesToGo = 0; static inline int timeToSearch = 0; -static inline bool doingNullMove = false; inline PVLine pvLine; @@ -252,15 +250,15 @@ SearchResults PVS(Board board, int depth, int alpha, int beta, int ply, SearchCo } // Null Move Pruning - if (!doingNullMove && staticEval >= beta) { + if (!ctx.doingNullMove && staticEval >= beta) { if (depth >= 3 && !board.InPossibleZug()) { Board copy = board; bool isLegal = copy.MakeMove(Move()); // Always legal so we dont check it - doingNullMove = true; + ctx.doingNullMove = true; int score = -PVS(copy, depth - 3, -beta, -beta + 1, ply + 1, ctx).score; - doingNullMove = false; + ctx.doingNullMove = false; if (searchStopped) return 0; if (score >= beta) return score; diff --git a/source/search.h b/source/search.h index 3446fb8..f42e8c4 100644 --- a/source/search.h +++ b/source/search.h @@ -109,6 +109,7 @@ public: class SearchContext { public: U64 nodes = 0; + bool doingNullMove = false; SearchContext(){} };