Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Only supports north and south
- template<Direction D>
- constexpr Bitboard fill(Bitboard b) {
- switch (D) {
- case NORTH:
- b |= (b << 8);
- b |= (b << 16);
- return b | (b << 32);
- case SOUTH:
- b |= (b >> 8);
- b |= (b >> 16);
- return b | (b >> 32);
- default: return b;
- }
- }
- template<Color color>
- inline constexpr Bitboard doubled_pawns(Position& board) {
- Bitboard us_pawns = board.bitboard_of(color, PAWN);
- return us_pawns & shift<relative_dir<color>(SOUTH)>(fill<relative_dir<color>(SOUTH)>(us_pawns));
- }
- template<Color c>
- inline constexpr Score evaluate_doubled_pawns(Position& board) {
- return DOUBLED_PAWN_PENALTY * pop_count(doubled_pawns<c>(board));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement