- end = cur + 2;
- return;
-
- case QUIETS_1_S1:
- endQuiets = end = generate<QUIETS>(pos, moves);
- score_noncaptures();
- end = std::partition(cur, end, has_positive_score);
- sort<MoveStack>(cur, end);
- return;
-
- case QUIETS_2_S1:
- cur = end;
- end = endQuiets;
+ endMoves = cur + 2;
+
+ killers[0] = ss->killers[0];
+ killers[1] = ss->killers[1];
+ killers[2].move = MOVE_NONE;
+
+ // Be sure countermoves are different from killers
+ if ( countermove != killers[0]
+ && countermove != killers[1])
+ *endMoves++ = countermove;
+ break;
+
+ case GOOD_QUIETS:
+ endQuiets = endMoves = generate<QUIETS>(pos, moves);
+ score<QUIETS>();
+ endMoves = std::partition(cur, endMoves, [](const ExtMove& m) { return m.value > VALUE_ZERO; });
+ insertion_sort(cur, endMoves);
+ break;
+
+ case BAD_QUIETS:
+ cur = endMoves;
+ endMoves = endQuiets;