- sort<MoveStack>(curMove, lastMove);
- return;
-
- case BAD_CAPTURES_S1:
- // Bad captures SEE value is already calculated so just pick them in order
- // to get SEE move ordering.
- curMove = badCaptures;
- lastMove = moves + MAX_MOVES;
- return;
-
- case EVASIONS_S2:
- lastMove = generate<MV_EVASION>(pos, moves);
- score_evasions();
- return;
-
- case QUIET_CHECKS_S3:
- lastMove = generate<MV_QUIET_CHECK>(pos, moves);
- return;
-
- case EVASION: case QSEARCH_0: case QSEARCH_1: case PROBCUT: case RECAPTURE:
- phase = STOP;
+ insertion_sort(cur, endMoves);
+ break;
+
+ case BAD_CAPTURES:
+ // Just pick them in reverse order to get MVV/LVA ordering
+ cur = moves + MAX_MOVES - 1;
+ endMoves = endBadCaptures;
+ break;
+
+ case ALL_EVASIONS:
+ endMoves = generate<EVASIONS>(pos, moves);
+ if (endMoves - moves > 1)
+ score<EVASIONS>();
+ break;
+
+ case CHECKS:
+ endMoves = generate<QUIET_CHECKS>(pos, moves);
+ break;
+
+ case EVASION: case QSEARCH_WITH_CHECKS: case QSEARCH_WITHOUT_CHECKS:
+ case PROBCUT: case RECAPTURE:
+ stage = STOP;
+ /* Fall through */
+