From af703bae66a80394c74dbd1117f69d1f98d5e822 Mon Sep 17 00:00:00 2001 From: dhb <1084714805@qq.com> Date: Fri, 14 Jun 2024 01:26:30 +0800 Subject: [PATCH] fix static eval init at root test r15 --- Rapfi/search/ab/searchstack.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Rapfi/search/ab/searchstack.h b/Rapfi/search/ab/searchstack.h index 17a1b9fe..e36485b8 100644 --- a/Rapfi/search/ab/searchstack.h +++ b/Rapfi/search/ab/searchstack.h @@ -92,9 +92,13 @@ class StackArray : std::vector reserve(maxPly + plyBeforeRoot + plyAfterMax); for (int i = -plyBeforeRoot; i < maxPly + plyAfterMax; i++) push_back(SearchStack {nextTriPvIndex(i), i}); + // Initialize static evaluation for plies before root - for (int i = 0; i <= plyBeforeRoot; i++) - (*this)[i].staticEval = initStaticEval; + Value staticEval = initStaticEval; + for (int i = plyBeforeRoot; i >= 0; i--) { + (*this)[i].staticEval = staticEval; + staticEval = -staticEval; + } } SearchStack *rootStack() { return &(*this)[plyBeforeRoot]; }