-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible wrong terminal state evaluation at PvNodes. #5589
Comments
while possible, do we have some evidence that is actually a result from this? |
For
the trap is seen at d29...
|
I'm not sure that game is related, I can imagine how the blunder can come in many ways indeed. so requiring more depth can solve it. |
worth noting that I tried many guards as gainer bounds, but never tried the PVNode guard which is probably the most important guard becasue across versions I didn't get it to change bench |
yeah, running a test with PVNode guard where it computes the statemate or 3-fold is worth trying. |
well at least good news that the PvNode check is functional at higher depths now I realise diff --git a/src/search.cpp b/src/search.cpp
index ac0b9c6d..1ab24c1b 100644
--- a/src/search.cpp
+++ b/src/search.cpp
@@ -1641,10 +1641,16 @@ Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta)
// Step 9. Check for mate
// All legal moves have been searched. A special case: if we are
// in check and no legal moves were found, it is checkmate.
- if (ss->inCheck && bestValue == -VALUE_INFINITE)
+ if (!moveCount)
{
- assert(!MoveList<LEGAL>(pos).size());
- return mated_in(ss->ply); // Plies to mate from the root
+ if (ss->inCheck)
+ {
+ assert(!MoveList<LEGAL>(pos).size());
+ return mated_in(ss->ply); // Plies to mate from the root
+ }
+
+ if (PvNode && !MoveList<LEGAL>(pos).size())
+ return VALUE_DRAW;
}
if (std::abs(bestValue) < VALUE_TB_WIN_IN_MAX_PLY && bestValue >= beta) |
sounds not easily fixable ATM and fishtest suggesting it's not as dangerous as I thought, so generating all legal moves is likely expensive for the tradeoff. probably worth not wasting time on it, and visit later. |
Describe the issue
Non-draw scores can propogate to the root from PV nodes ending with stalemates in qsearch causing wrong evals for such terminal state and a possibly a mismatch between that PV reported terminated and the eval.
Expected behavior
Correct terminal state at least in PV nodes.
Steps to reproduce
Anything else?
see also https://www.chess.com/computer-chess-championship#event=ccc23-rapid-finals&game=81
Operating system
All
Stockfish version
all
The text was updated successfully, but these errors were encountered: