]> git.sesse.net Git - stockfish/blobdiff - src/movepick.cpp
Use std::stable_sort() instead of std::sort()
[stockfish] / src / movepick.cpp
index ea435026241f21b72275af2fd0585b35480ff9a8..0dd44bbd8db54925e035728bea470075fe5004ae 100644 (file)
@@ -123,7 +123,7 @@ void MovePicker::go_next_phase() {
   case PH_GOOD_CAPTURES:
       lastMove = generate_captures(pos, moves);
       score_captures();
-      std::sort(moves, lastMove);
+      std::stable_sort(moves, lastMove);
       return;
 
   case PH_KILLERS:
@@ -134,7 +134,7 @@ void MovePicker::go_next_phase() {
   case PH_NONCAPTURES:
       lastMove = generate_noncaptures(pos, moves);
       score_noncaptures();
-      std::sort(moves, lastMove);
+      std::stable_sort(moves, lastMove);
       return;
 
   case PH_BAD_CAPTURES:
@@ -142,20 +142,20 @@ void MovePicker::go_next_phase() {
       // to get SEE move ordering.
       curMove = badCaptures;
       lastMove = lastBadCapture;
-      std::sort(badCaptures, lastMove);
+      std::stable_sort(badCaptures, lastMove);
       return;
 
   case PH_EVASIONS:
       assert(pos.is_check());
       lastMove = generate_evasions(pos, moves, pinned);
       score_evasions();
-      std::sort(moves, lastMove);
+      std::stable_sort(moves, lastMove);
       return;
 
   case PH_QCAPTURES:
       lastMove = generate_captures(pos, moves);
       score_captures();
-      std::sort(moves, lastMove);
+      std::stable_sort(moves, lastMove);
       return;
 
   case PH_QCHECKS: