#include <algorithm>
#include <cassert>
+#include <cfloat>
#include <cmath>
#include <cstring>
#include <iostream>
// Stop search early if one move seems to be much better than others
if ( depth >= 12
+ && BestMoveChanges <= DBL_EPSILON
&& !stop
&& PVSize == 1
&& bestValue > VALUE_MATED_IN_MAX_PLY
} while ( tte
&& pos.pseudo_legal(m = tte->move()) // Local copy, TT could change
- && pos.legal(m, pos.pinned_pieces())
+ && pos.legal(m, pos.pinned_pieces(pos.side_to_move()))
&& ply < MAX_PLY
&& (!pos.is_draw() || ply < 2));