From 16abc165d84b390c175ade5d1b19b1dab703129b Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Sat, 21 Mar 2009 14:51:31 +0100 Subject: [PATCH] Fix: In qsearch do not use TT value when in a PV node We already do like this in search_pv(), so extend also in qsearch(). Bug spotted by Joona Kiiski. Signed-off-by: Marco Costalba --- src/search.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 03c566eb..64acc3a8 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1417,10 +1417,14 @@ namespace { if (pos.is_draw()) return VALUE_DRAW; - // Transposition table lookup - const TTEntry* tte = TT.retrieve(pos); - if (tte && ok_to_use_TT(tte, depth, beta, ply)) - return value_from_tt(tte->value(), ply); + // Transposition table lookup, only when not in PV + bool pvNode = (beta - alpha != 1); + if (!pvNode) + { + const TTEntry* tte = TT.retrieve(pos); + if (tte && ok_to_use_TT(tte, depth, beta, ply)) + return value_from_tt(tte->value(), ply); + } // Evaluate the position statically EvalInfo ei; @@ -1443,7 +1447,6 @@ namespace { // Initialize a MovePicker object for the current position, and prepare // to search the moves. Because the depth is <= 0 here, only captures, // queen promotions and checks (only if depth == 0) will be generated. - bool pvNode = (beta - alpha != 1); MovePicker mp = MovePicker(pos, pvNode, MOVE_NONE, EmptySearchStack, depth, isCheck ? NULL : &ei); Move move; int moveCount = 0; -- 2.39.2