1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 00:33:09 +00:00

Don't need to order pawns a second time

This commit is contained in:
Marco Costalba 2016-05-09 10:45:48 +02:00
parent 12c3e394e7
commit 56d1bef249

View file

@ -696,13 +696,9 @@ uint64_t probe_table(const Position& pos, Entry* entry, WDLScore wdl = WDLDraw,
for (int i = 0; i < size; ++i)
squares[i] ^= 7; // Horizontal flip: SQ_H1 -> SQ_A1
// Reorder the leading pawns according to Ptwist table, in descending order,
// and encode them.
// Encode leading pawns. Note that any previous horizontal flip preserves
// the order because MapToEdges[] is (almost) flip invariant.
if (entry->hasPawns) {
auto comp = [] (Square i, Square j) { return MapToEdges[i] > MapToEdges[j]; };
std::sort(squares + 1, squares + leadPawnsCnt, comp);
idx = Pawnidx[leadPawnsCnt - 1][23 - MapToEdges[squares[0]] / 2];
for (int i = 1; i < leadPawnsCnt; ++i)