- if (dtz > 0)
- wdl = (dtz + cnt50 <= 100) ? WDLWin : WDLCursedWin;
- else if (dtz < 0)
- wdl = (-dtz + cnt50 <= 100) ? WDLLoss : WDLBlessedLoss;
-
- // Determine the score to report to the user.
- score = WDL_to_value[wdl + 2];
-
- // If the position is winning or losing, but too few moves left, adjust the
- // score to show how close it is to winning or losing.
- // NOTE: int(PawnValueEg) is used as scaling factor in score_to_uci().
- if (wdl == WDLCursedWin && dtz <= 100)
- score = (Value)(((200 - dtz - cnt50) * int(PawnValueEg)) / 200);
- else if (wdl == WDLBlessedLoss && dtz >= -100)
- score = -(Value)(((200 + dtz - cnt50) * int(PawnValueEg)) / 200);
-
- // Now be a bit smart about filtering out moves.
- size_t j = 0;
-
- if (dtz > 0) { // winning (or 50-move rule draw)
- int best = 0xffff;
-
- for (size_t i = 0; i < rootMoves.size(); ++i) {
- int v = rootMoves[i].score;
+ // Probe and rank each move
+ for (auto& m : rootMoves)
+ {
+ pos.do_move(m.pv[0], st);