- template<Color Us> bool is_KQKRPs(const Position& pos) {
- const Color Them = (Us == WHITE ? BLACK : WHITE);
- return !pos.count<PAWN>(Us)
- && pos.non_pawn_material(Us) == QueenValueMg
- && pos.count<QUEEN>(Us) == 1
- && pos.count<ROOK>(Them) == 1
- && pos.count<PAWN>(Them) >= 1;
+ bool is_KQKRPs(const Position& pos, Color us) {
+ return !pos.count<PAWN>(us)
+ && pos.non_pawn_material(us) == QueenValueMg
+ && pos.count<QUEEN>(us) == 1
+ && pos.count<ROOK>(~us) == 1
+ && pos.count<PAWN>(~us) >= 1;