- 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];
+ PieceType pt;
+ for (pt = QUEEN; pt >= KNIGHT; --pt)
+ if (target & pos.pieces(C, pt))
+ break;
+
+ return pt;