fix endgame solver timeout handling for also-solve-move#457
Merged
Conversation
This fixes a bug where the endgame solver would fail when using SetAlsoSolveMove (used by the analyzer for volunteer mode) if the main solve timed out before completing all requested plies. The issue had three parts: 1. When the main solve timed out at (say) ply 7 after completing ply 6, it would try to solve the also-solve move using the expired context, which would immediately fail. 2. Even if it succeeded, the also-solve move would be solved at ply 7 while the best move was only solved to ply 6, making results incomparable. 3. The best move from the partial solve wasn't saved to variations, so the also-solve move would incorrectly become the "best" move. The fix: - Track lastCompletedPly in all three parallel algorithms (ABDADA, LazySMP, TreeSplit) to know what depth was actually completed - When solving also-solve move after a timeout, use the same completed ply depth as the best move to ensure comparable results - Create a fresh 60-second timeout context specifically for solving the also-solve move, since the original context has expired - Save the best move to variations before breaking on timeout, so it doesn't get lost when also-solve move is added to variations This ensures both moves are solved to the same depth and results are properly comparable for spread loss calculation. Also updated endgame.txt helptext to document the timeout behavior. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes a bug where the endgame solver would fail when using SetAlsoSolveMove (used by the analyzer for volunteer mode) if the main solve timed out before completing all requested plies.
The issue had three parts:
When the main solve timed out at (say) ply 7 after completing ply 6, it would try to solve the also-solve move using the expired context, which would immediately fail.
Even if it succeeded, the also-solve move would be solved at ply 7 while the best move was only solved to ply 6, making results incomparable.
The best move from the partial solve wasn't saved to variations, so the also-solve move would incorrectly become the "best" move.
The fix:
Track lastCompletedPly in all three parallel algorithms (ABDADA, LazySMP, TreeSplit) to know what depth was actually completed
When solving also-solve move after a timeout, use the same completed ply depth as the best move to ensure comparable results
Create a fresh 60-second timeout context specifically for solving the also-solve move, since the original context has expired
Save the best move to variations before breaking on timeout, so it doesn't get lost when also-solve move is added to variations
This ensures both moves are solved to the same depth and results are properly comparable for spread loss calculation.
Also updated endgame.txt helptext to document the timeout behavior.