Clear engine suggestion arrows after reaching checkmate or stalemate #724
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.
Summary
This ensures that we emit an evaluation from
UCIProtocol
once checkmate or stalemate has been reached, addressing #717.Stockfish sends the message
info depth 0 score mate 0
when checkmate is reached andinfo depth 0 score cp 0
when stalemate is reached. Before this change, these messages were being filtered out (by an explicit check for checkmate and becausenodes
andtime
were missing for stalemate), so no evaluation was emitted. This led to the analysis board retaining a stale list of "best moves" and suggesting nonsense.An alternative approach would be to allow for the stale "best moves" list, and just hide the arrows if the game is over. I prefer the approach taken in this PR, however, because it respects Stockfish as the source of truth for the suggestions.
This assumes that there are no cases in which it is important to filter out a message from Stockfish because it did not include
nodes
ortime
. If such cases do exist, please let me know.Repro steps
Screenshots
Before
After