mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00:00
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:
parent
e0bafa1911
commit
a0afe32d16
2 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -758,7 +758,7 @@ Ret do_probe_table(const Position& pos, T* entry, WDLScore wdl, ProbeState* resu
|
|||
if (entry->hasPawns) {
|
||||
idx = LeadPawnIdx[leadPawnsCnt][squares[0]];
|
||||
|
||||
std::sort(squares + 1, squares + leadPawnsCnt, pawns_comp);
|
||||
std::stable_sort(squares + 1, squares + leadPawnsCnt, pawns_comp);
|
||||
|
||||
for (int i = 1; i < leadPawnsCnt; ++i)
|
||||
idx += Binomial[i][MapPawns[squares[i]]];
|
||||
|
@ -859,7 +859,7 @@ encode_remaining:
|
|||
|
||||
while (d->groupLen[++next])
|
||||
{
|
||||
std::sort(groupSq, groupSq + d->groupLen[next]);
|
||||
std::stable_sort(groupSq, groupSq + d->groupLen[next]);
|
||||
uint64_t n = 0;
|
||||
|
||||
// Map down a square if "comes later" than a square in the previous
|
||||
|
|
Loading…
Add table
Reference in a new issue