Skip to content

fix endgame solver timeout handling for also-solve-move#457

Merged
domino14 merged 1 commit intomasterfrom
fix-endgame-also-solve-timeout
Mar 9, 2026
Merged

fix endgame solver timeout handling for also-solve-move#457
domino14 merged 1 commit intomasterfrom
fix-endgame-also-solve-timeout

Conversation

@domino14
Copy link
Owner

@domino14 domino14 commented Mar 9, 2026

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.

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>
@domino14 domino14 merged commit f8b713a into master Mar 9, 2026
2 checks passed
@domino14 domino14 deleted the fix-endgame-also-solve-timeout branch March 9, 2026 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant