+ // King cannot be recaptured
+ if (type_of_piece(piece) == KING)
+ return seeValues[capture];
+
+ // If captured piece is defended by enemy pawns or knights then SEE is negative
+ // when captured piece value does not compensate the lost of capturing one.
+ if (shortcut)
+ {
+ pieceDiff = seeValues[piece] - seeValues[capture];
+
+ if ( pieceDiff > seeValues[PAWN]
+ &&(attacks_from<PAWN>(to, us) & pieces(PAWN, them)))
+ return -(pieceDiff - seeValues[PAWN] / 2);
+
+ if ( pieceDiff > seeValues[KNIGHT]
+ && pieces(KNIGHT, them)
+ &&(pieces(KNIGHT, them) & attacks_from<KNIGHT>(to)))
+ return -(pieceDiff - seeValues[KNIGHT] / 2);
+ }
+