- m.value = PieceValue[MG][pos.piece_on(to_sq(m))]
- - Value(type_of(pos.moved_piece(m)))
- + (type_of(m) == ENPASSANT ? PieceValue[MG][PAWN] :
- type_of(m) == PROMOTION ? PieceValue[MG][promotion_type(m)] - PieceValue[MG][PAWN]
- : VALUE_ZERO);
+ if (type_of(m) == ENPASSANT)
+ m.value = PieceValue[MG][PAWN] - Value(PAWN);
+
+ else if (type_of(m) == PROMOTION)
+ m.value = PieceValue[MG][pos.piece_on(to_sq(m))] - Value(PAWN)
+ + PieceValue[MG][promotion_type(m)] - PieceValue[MG][PAWN];
+ else
+ m.value = PieceValue[MG][pos.piece_on(to_sq(m))]
+ - Value(type_of(pos.moved_piece(m)));