- case PH_MATE_KILLER:
- if (mateKiller != MOVE_NONE)
- {
- assert(move_is_ok(mateKiller));
- if (move_is_legal(pos, mateKiller, pinned))
- return mateKiller;
- }
- break;
-
- case PH_GOOD_CAPTURES:
- numOfMoves = generate_captures(pos, moves);
- score_captures();
- std::sort(moves, moves + numOfMoves);
- movesPicked = 0;
- break;
-
- case PH_KILLERS:
- movesPicked = numOfMoves = 0;
- if (killer1 != MOVE_NONE && move_is_legal(pos, killer1, pinned) && !pos.move_is_capture(killer1))
- moves[numOfMoves++].move = killer1;
- if (killer2 != MOVE_NONE && move_is_legal(pos, killer2, pinned) && !pos.move_is_capture(killer2) )
- moves[numOfMoves++].move = killer2;
- break;
-
- case PH_NONCAPTURES:
- checkKillers = (numOfMoves != 0); // previous phase is PH_KILLERS
- checkLegal = true;
- numOfMoves = generate_noncaptures(pos, moves);
- score_noncaptures();
- std::sort(moves, moves + numOfMoves);
- movesPicked = 0;
- break;
-
- case PH_BAD_CAPTURES:
- // Bad captures SEE value is already calculated so just sort them
- // to get SEE move ordering.
- std::sort(badCaptures, badCaptures + numOfBadCaptures);
- movesPicked = 0;
- break;
-
- case PH_EVASIONS:
- assert(pos.is_check());
- numOfMoves = generate_evasions(pos, moves, pinned);
- score_evasions();
- std::sort(moves, moves + numOfMoves);
- movesPicked = 0;
- break;
-
- case PH_QCAPTURES:
- numOfMoves = generate_captures(pos, moves);
- score_captures();
- std::sort(moves, moves + numOfMoves);
- movesPicked = 0;
- break;
-
- case PH_QCHECKS:
- // Perhaps we should order moves move here? FIXME
- numOfMoves = generate_non_capture_checks(pos, moves, dc);
- movesPicked = 0;
- break;
-
- case PH_STOP:
- return MOVE_NONE;
-
- default:
- assert(false);
- return MOVE_NONE;
- }
- }