Use stable sort to make sure bench with TB yields same results everywhere.

std::sort() is not stable so different implementations can produce different results:
use the stable version instead.

Observed for '8/6k1/5r2/8/8/8/1K6/Q7 w - - 0 1' yielding different bench results for gcc and MSVC
and 3-4-5 syzygy TB prior to this patch.

closes https://github.com/official-stockfish/Stockfish/pull/3083

No functional change.
This commit is contained in:
mstembera
2020-08-30 18:40:49 -07:00
committed by Joost VandeVondele
parent e0bafa1911
commit a0afe32d16
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -1964,7 +1964,7 @@ void Tablebases::rank_root_moves(Position& pos, Search::RootMoves& rootMoves) {
if (RootInTB)
{
// Sort moves according to TB rank
std::sort(rootMoves.begin(), rootMoves.end(),
std::stable_sort(rootMoves.begin(), rootMoves.end(),
[](const RootMove &a, const RootMove &b) { return a.tbRank > b.tbRank; } );
// Probe during search only if DTZ is not available and we are winning