- ttMove = (ttm && pos.is_pseudo_legal(ttm) ? ttm : MOVE_NONE);
- phase += (ttMove == MOVE_NONE);
-}
-
-MovePicker::MovePicker(const Position& p, Move ttm, const History& h,
- PieceType parentCapture) : pos(p), H(h) {
-
- assert (!pos.in_check());
-
- // In ProbCut we consider only captures better than parent's move
- captureThreshold = PieceValueMidgame[Piece(parentCapture)];
- curMove = lastMove = 0;
- phase = PROBCUT;
-
- if ( ttm != MOVE_NONE
- && (!pos.is_capture(ttm) || pos.see(ttm) <= captureThreshold))
- ttm = MOVE_NONE;
-
- ttMove = (ttm && pos.is_pseudo_legal(ttm) ? ttm : MOVE_NONE);
- phase += (ttMove == MOVE_NONE);
-}
-
-
-/// MovePicker::score_captures(), MovePicker::score_noncaptures() and
-/// MovePicker::score_evasions() assign a numerical move ordering score
-/// to each move in a move list. The moves with highest scores will be
-/// picked first by next_move().
-
-void MovePicker::score_captures() {
- // Winning and equal captures in the main search are ordered by MVV/LVA.
- // Suprisingly, this appears to perform slightly better than SEE based
- // move ordering. The reason is probably that in a position with a winning
- // capture, capturing a more valuable (but sufficiently defended) piece
- // first usually doesn't hurt. The opponent will have to recapture, and
- // the hanging piece will still be hanging (except in the unusual cases
- // where it is possible to recapture with the hanging piece). Exchanging
- // big pieces before capturing a hanging piece probably helps to reduce
- // the subtree size.
- // In main search we want to push captures with negative SEE values to
- // badCaptures[] array, but instead of doing it now we delay till when
- // the move has been picked up in pick_move_from_list(), this way we save
- // some SEE calls in case we get a cutoff (idea from Pablo Vazquez).
- Move m;
-
- for (MoveStack* cur = moves; cur != lastMove; cur++)
- {
- m = cur->move;
- cur->score = PieceValueMidgame[pos.piece_on(to_sq(m))]
- - type_of(pos.piece_moved(m));
-
- if (is_promotion(m))
- cur->score += PieceValueMidgame[Piece(promotion_piece_type(m))];
- }