- PieceType threat = PAWN;
- if (targets & pos.pieces(Them, KNIGHT)) threat = KNIGHT;
- if (targets & pos.pieces(Them, BISHOP)) threat = BISHOP;
- if (targets & pos.pieces(Them, ROOK)) threat = ROOK;
- if (targets & pos.pieces(Them, QUEEN)) threat = QUEEN;
-
- return threat_values[threat];
+ for (PieceType pt = QUEEN; pt > PAWN; --pt)
+ if (target & pos.pieces(C, pt))
+ return pt;
+
+ return PAWN;