]> git.sesse.net Git - stockfish/commitdiff
Correctly score enpassant captures
authorMarco Costalba <mcostalba@gmail.com>
Sun, 3 Feb 2013 08:01:55 +0000 (09:01 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 3 Feb 2013 08:08:32 +0000 (09:08 +0100)
Surprisingly this rare case was not considered
when scoring a capture.

Also take in account that in the promotion case
we gain a new piece (typically a queen) but we
lose the promoting pawn.

These small issues were present since Glaurung times!

Found while browsing DiscoCheck sources

bench: 5400063

src/movepick.cpp

index e6b16cc495d238ff078324bf9057e85ca09aa6df..4cf45ad36202b715bd8c8e9efcdef4353256c186 100644 (file)
@@ -168,7 +168,10 @@ void MovePicker::score_captures() {
                  - type_of(pos.piece_moved(m));
 
       if (type_of(m) == PROMOTION)
-          it->score += PieceValue[MG][promotion_type(m)];
+          it->score += PieceValue[MG][promotion_type(m)] - PieceValue[MG][PAWN];
+
+      else if (type_of(m) == ENPASSANT)
+          it->score += PieceValue[MG][PAWN];
   }
 }