- // In ProbCut we generate only captures that are better than the parent's
- // captured piece.
- captureThreshold = PieceValue[MG][pt];
- ttMove = (ttm && pos.pseudo_legal(ttm) ? ttm : MOVE_NONE);
-
- if (ttMove && (!pos.capture(ttMove) || pos.see(ttMove) <= captureThreshold))
- ttMove = MOVE_NONE;
-
- end += (ttMove != MOVE_NONE);
-}
-
-
-/// score() assign a numerical value to each move in a move list. The moves with
-/// highest values will be picked first.
-template<>
-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 the
- // badCaptures[] array, but instead of doing it now we delay until the move
- // has been picked up in pick_move_from_list(). This way we save some SEE
- // calls in case we get a cutoff.
- Move m;
-
- for (ExtMove* it = moves; it != end; ++it)
- {
- m = it->move;
- it->value = PieceValue[MG][pos.piece_on(to_sq(m))]
- - Value(type_of(pos.moved_piece(m)));
-
- if (type_of(m) == ENPASSANT)
- it->value += PieceValue[MG][PAWN];
-
- else if (type_of(m) == PROMOTION)
- it->value += PieceValue[MG][promotion_type(m)] - PieceValue[MG][PAWN];
- }
-}
-
-template<>
-void MovePicker::score<QUIETS>() {
-
- Move m;
-
- for (ExtMove* it = moves; it != end; ++it)
- {
- m = it->move;
- it->value = history[pos.moved_piece(m)][to_sq(m)];
- }
-}
-
-template<>
-void MovePicker::score<EVASIONS>() {
- // Try good captures ordered by MVV/LVA, then non-captures if destination square
- // is not under attack, ordered by history value, then bad-captures and quiet
- // moves with a negative SEE. This last group is ordered by the SEE value.
- Move m;
- Value see;
-
- for (ExtMove* it = moves; it != end; ++it)
- {
- m = it->move;
- if ((see = pos.see_sign(m)) < VALUE_ZERO)
- it->value = see - HistoryStats::Max; // At the bottom
-
- else if (pos.capture(m))
- it->value = PieceValue[MG][pos.piece_on(to_sq(m))]
- - Value(type_of(pos.moved_piece(m))) + HistoryStats::Max;
- else
- it->value = history[pos.moved_piece(m)][to_sq(m)];
- }