Fix `go mate x` in multithreading
Fixes two issues with master for go mate x:
- when running go mate x in losing positions, master always goes to the
maximal depth, arguably against what the UCI protocol demands
- when running go mate x in winning positions with multiple
threads, master may return non-mate scores from the search (this issue
is present in stockfish since at least sf16) The issues are fixed by
(a) also checking if score is mate -x and by (b) only letting
mainthread stop the search for go mate x commands, and by not looking
for a best thread but using mainthread as per the default. Related:
niklasf/python-chess#1070
More diagnostics can be found here peregrineshahin#6 (comment)
closes https://github.com/official-stockfish/Stockfish/pull/5094
No functional change
Co-Authored-By: Robert Nürnberg <28635489+robertnurnberg@users.noreply.github.com>