]> git.sesse.net Git - stockfish/blobdiff - src/movepick.cpp
Correctly score capture underpromotions
[stockfish] / src / movepick.cpp
index b9594ba1cf998689596a139300ffc473688a9285..c898127f3ecef51dd8b96b2bbf41737ed45082c7 100644 (file)
@@ -51,12 +51,12 @@ namespace {
   const uint8_t QsearchRecapturesTable[] = { PH_TT_MOVE, PH_QRECAPTURES, PH_STOP };
   const uint8_t ProbCutTable[] = { PH_TT_MOVE, PH_GOOD_PROBCUT, PH_STOP };
 
-  // Unary predicate used by std::partition to split positive scores from ramining
+  // Unary predicate used by std::partition to split positive scores from remaining
   // ones so to sort separately the two sets, and with the second sort delayed.
   inline bool has_positive_score(const MoveStack& move) { return move.score > 0; }
 
   // Picks and pushes to the front the best move in range [firstMove, lastMove),
-  // it is faster then sorting all the moves in advance when moves are few, as
+  // it is faster than sorting all the moves in advance when moves are few, as
   // normally are the possible captures.
   inline MoveStack* pick_best(MoveStack* firstMove, MoveStack* lastMove)
   {
@@ -255,7 +255,7 @@ void MovePicker::score_captures() {
                   - piece_type(pos.piece_on(move_from(m)));
 
       if (move_is_promotion(m))
-          cur->score += QueenValueMidgame;
+          cur->score += piece_value_midgame(Piece(promotion_piece_type(m)));
   }
 }
 
@@ -331,8 +331,7 @@ Move MovePicker::get_next_move() {
               if (seeValue >= captureThreshold)
                   return move;
 
-              // Losing capture, move it to the tail of the array, note
-              // that move has now been already checked for pseudo legality.
+              // Losing capture, move it to the tail of the array
               (--badCaptures)->move = move;
               badCaptures->score = seeValue;
           }