BenBot 1.7.5
A chess engine
Loading...
Searching...
No Matches
Bitboard masks
Collaboration diagram for Bitboard masks:

Files

file  Masks.hpp

Namespaces

namespace  chess
namespace  chess::board
namespace  chess::board::masks
namespace  chess::board::masks::files
namespace  chess::board::masks::ranks
namespace  chess::board::masks::starting
namespace  chess::board::masks::starting::black
namespace  chess::board::masks::starting::white
constexpr auto chess::board::masks::ALL = 0XFFFFFFFFFFFFFFFF_bb
constexpr auto chess::board::masks::NONE = 0X0_bb
constexpr auto chess::board::masks::DARK_SQUARES = 0xAA55AA55AA55AA55_bb
constexpr auto chess::board::masks::LIGHT_SQUARES = 0x55AA55AA55AA55AA_bb
constexpr auto chess::board::masks::MAIN_DIAGONAL = 0x8040201008040201_bb
constexpr auto chess::board::masks::MAIN_ANTIDIAGONAL = 0x0102040810204080_bb
constexpr auto chess::board::masks::CENTER = 0X1818000000_bb
constexpr auto chess::board::masks::PERIMETER = 0XFF818181818181FF_bb
constexpr auto chess::board::masks::diagonal (const Square &square) noexcept -> Bitboard
constexpr auto chess::board::masks::antidiagonal (const Square &square) noexcept -> Bitboard
constexpr auto chess::board::masks::queenside_castle_rook_pos_mask (const Color side) noexcept -> Bitboard
constexpr auto chess::board::masks::kingside_castle_rook_pos_mask (const Color side) noexcept -> Bitboard
constexpr auto chess::board::masks::files::A = 0x0101010101010101_bb
constexpr auto chess::board::masks::files::B = 0X202020202020202_bb
constexpr auto chess::board::masks::files::C = 0X404040404040404_bb
constexpr auto chess::board::masks::files::D = 0X808080808080808_bb
constexpr auto chess::board::masks::files::E = 0X1010101010101010_bb
constexpr auto chess::board::masks::files::F = 0X2020202020202020_bb
constexpr auto chess::board::masks::files::G = 0X4040404040404040_bb
constexpr auto chess::board::masks::files::H = 0x8080808080808080_bb
constexpr auto chess::board::masks::files::get (const File file) noexcept -> Bitboard
constexpr auto chess::board::masks::ranks::ONE = 0x00000000000000FF_bb
constexpr auto chess::board::masks::ranks::TWO = 0XFF00_bb
constexpr auto chess::board::masks::ranks::THREE = 0XFF0000_bb
constexpr auto chess::board::masks::ranks::FOUR = 0XFF000000_bb
constexpr auto chess::board::masks::ranks::FIVE = 0XFF00000000_bb
constexpr auto chess::board::masks::ranks::SIX = 0XFF0000000000_bb
constexpr auto chess::board::masks::ranks::SEVEN = 0XFF000000000000_bb
constexpr auto chess::board::masks::ranks::EIGHT = 0xFF00000000000000_bb
constexpr auto chess::board::masks::ranks::get (const Rank rank) noexcept -> Bitboard
constexpr auto chess::board::masks::starting::white::PAWNS = ranks::TWO
constexpr auto chess::board::masks::starting::white::ROOKS = 0X81_bb
constexpr auto chess::board::masks::starting::white::KNIGHTS = 0X42_bb
constexpr auto chess::board::masks::starting::white::BISHOPS = 0X24_bb
constexpr auto chess::board::masks::starting::white::QUEEN = 0X8_bb
constexpr auto chess::board::masks::starting::white::KING = 0X10_bb
constexpr auto chess::board::masks::starting::black::PAWNS = ranks::SEVEN
constexpr auto chess::board::masks::starting::black::ROOKS = 0X8100000000000000_bb
constexpr auto chess::board::masks::starting::black::KNIGHTS = 0X4200000000000000_bb
constexpr auto chess::board::masks::starting::black::BISHOPS = 0X2400000000000000_bb
constexpr auto chess::board::masks::starting::black::QUEEN = 0X800000000000000_bb
constexpr auto chess::board::masks::starting::black::KING = 0X1000000000000000_bb
constexpr auto chess::board::masks::starting::pawns (const Color color) noexcept -> Bitboard
constexpr auto chess::board::masks::starting::rooks (const Color color) noexcept -> Bitboard
constexpr auto chess::board::masks::starting::knights (const Color color) noexcept -> Bitboard
constexpr auto chess::board::masks::starting::bishops (const Color color) noexcept -> Bitboard
constexpr auto chess::board::masks::starting::queen (const Color color) noexcept -> Bitboard
constexpr auto chess::board::masks::starting::king (const Color color) noexcept -> Bitboard

Detailed Description

Compile-time bitboard constants and masks.

Function Documentation

◆ antidiagonal()

auto chess::board::masks::antidiagonal ( const Square & square) -> Bitboard
nodiscardconstexprnoexcept

Returns a bitboard with all squares on the same antidiagonal as the given square set to 1.

Definition at line 84 of file Masks.hpp.

◆ bishops()

auto chess::board::masks::starting::bishops ( const Color color) -> Bitboard
nodiscardconstexprnoexcept

Returns a bitboard mask for the starting position of the bishops for the given side.

Definition at line 326 of file Masks.hpp.

◆ diagonal()

auto chess::board::masks::diagonal ( const Square & square) -> Bitboard
nodiscardconstexprnoexcept

Returns a bitboard with all squares on the same diagonal as the given square set to 1.

Definition at line 73 of file Masks.hpp.

◆ get() [1/2]

auto chess::board::masks::files::get ( const File file) -> Bitboard
nodiscardconstexprnoexcept

Returns a bitboard with all squares on the requested file set to 1.

Definition at line 171 of file Masks.hpp.

◆ get() [2/2]

auto chess::board::masks::ranks::get ( const Rank rank) -> Bitboard
nodiscardconstexprnoexcept

Returns a bitboard with all squares on the requested rank set to 1.

Definition at line 213 of file Masks.hpp.

◆ king()

auto chess::board::masks::starting::king ( const Color color) -> Bitboard
nodiscardconstexprnoexcept

Returns a bitboard mask for the starting position of the king for the given side.

Definition at line 344 of file Masks.hpp.

◆ kingside_castle_rook_pos_mask()

auto chess::board::masks::kingside_castle_rook_pos_mask ( const Color side) -> Bitboard
nodiscardconstexprnoexcept

Returns a bitboard mask with the starting & ending rook positions of a kingside castling move. This mask can be XOR'ed with the rooks bitboard to update the rook position after kingside castling.

See also
queenside_castle_rook_pos_mask()

Definition at line 119 of file Masks.hpp.

◆ knights()

auto chess::board::masks::starting::knights ( const Color color) -> Bitboard
nodiscardconstexprnoexcept

Returns a bitboard mask for the starting position of the knights for the given side.

Definition at line 317 of file Masks.hpp.

◆ pawns()

auto chess::board::masks::starting::pawns ( const Color color) -> Bitboard
nodiscardconstexprnoexcept

Returns a bitboard mask for the starting position of the pawns for the given side.

Definition at line 299 of file Masks.hpp.

◆ queen()

auto chess::board::masks::starting::queen ( const Color color) -> Bitboard
nodiscardconstexprnoexcept

Returns a bitboard mask for the starting position of the queen for the given side.

Definition at line 335 of file Masks.hpp.

◆ queenside_castle_rook_pos_mask()

auto chess::board::masks::queenside_castle_rook_pos_mask ( const Color side) -> Bitboard
nodiscardconstexprnoexcept

Returns a bitboard mask with the starting & ending rook positions of a queenside castling move. This mask can be XOR'ed with the rooks bitboard to update the rook position after queenside castling.

See also
kingside_castle_rook_pos_mask()

Definition at line 100 of file Masks.hpp.

◆ rooks()

auto chess::board::masks::starting::rooks ( const Color color) -> Bitboard
nodiscardconstexprnoexcept

Returns a bitboard mask for the starting position of the rooks for the given side.

Definition at line 308 of file Masks.hpp.

Variable Documentation

◆ A

auto chess::board::masks::files::A = 0x0101010101010101_bb
inlineconstexpr

A bitboard with all squares on the A file set to 1.

Definition at line 145 of file Masks.hpp.

◆ ALL

auto chess::board::masks::ALL = 0XFFFFFFFFFFFFFFFF_bb
inlineconstexpr

A bitboard with all bits set to 1.

Definition at line 49 of file Masks.hpp.

◆ B

auto chess::board::masks::files::B = 0X202020202020202_bb
inlineconstexpr

A bitboard with all squares on the B file set to 1.

Definition at line 148 of file Masks.hpp.

◆ BISHOPS [1/2]

auto chess::board::masks::starting::black::BISHOPS = 0X2400000000000000_bb
inlineconstexpr

A bitboard mask for the starting position of Black's bishops.

Definition at line 283 of file Masks.hpp.

◆ BISHOPS [2/2]

auto chess::board::masks::starting::white::BISHOPS = 0X24_bb
inlineconstexpr

A bitboard mask for the starting position of White's bishops.

Definition at line 250 of file Masks.hpp.

◆ C

auto chess::board::masks::files::C = 0X404040404040404_bb
inlineconstexpr

A bitboard with all squares on the C file set to 1.

Definition at line 151 of file Masks.hpp.

◆ CENTER

auto chess::board::masks::CENTER = 0X1818000000_bb
inlineconstexpr

A bitboard with the 4 center squares (D4, D5, E4, E5) set to 1.

Definition at line 67 of file Masks.hpp.

◆ D

auto chess::board::masks::files::D = 0X808080808080808_bb
inlineconstexpr

A bitboard with all squares on the D file set to 1.

Definition at line 154 of file Masks.hpp.

◆ DARK_SQUARES

auto chess::board::masks::DARK_SQUARES = 0xAA55AA55AA55AA55_bb
inlineconstexpr

A bitboard with all the dark squares set to 1.

Definition at line 55 of file Masks.hpp.

◆ E

auto chess::board::masks::files::E = 0X1010101010101010_bb
inlineconstexpr

A bitboard with all squares on the E file set to 1.

Definition at line 157 of file Masks.hpp.

◆ EIGHT

auto chess::board::masks::ranks::EIGHT = 0xFF00000000000000_bb
inlineconstexpr

A bitboard with all squares on the eighth rank set to 1.

Definition at line 210 of file Masks.hpp.

◆ F

auto chess::board::masks::files::F = 0X2020202020202020_bb
inlineconstexpr

A bitboard with all squares on the F file set to 1.

Definition at line 160 of file Masks.hpp.

◆ FIVE

auto chess::board::masks::ranks::FIVE = 0XFF00000000_bb
inlineconstexpr

A bitboard with all squares on the fifth rank set to 1.

Definition at line 201 of file Masks.hpp.

◆ FOUR

auto chess::board::masks::ranks::FOUR = 0XFF000000_bb
inlineconstexpr

A bitboard with all squares on the fourth rank set to 1.

Definition at line 198 of file Masks.hpp.

◆ G

auto chess::board::masks::files::G = 0X4040404040404040_bb
inlineconstexpr

A bitboard with all squares on the G file set to 1.

Definition at line 163 of file Masks.hpp.

◆ H

auto chess::board::masks::files::H = 0x8080808080808080_bb
inlineconstexpr

A bitboard with all squares on the H file set to 1.

Definition at line 166 of file Masks.hpp.

◆ KING [1/2]

auto chess::board::masks::starting::black::KING = 0X1000000000000000_bb
inlineconstexpr

A bitboard mask for the starting position of Black's king.

Definition at line 289 of file Masks.hpp.

◆ KING [2/2]

auto chess::board::masks::starting::white::KING = 0X10_bb
inlineconstexpr

A bitboard mask for the starting position of White's king.

Definition at line 256 of file Masks.hpp.

◆ KNIGHTS [1/2]

auto chess::board::masks::starting::black::KNIGHTS = 0X4200000000000000_bb
inlineconstexpr

A bitboard mask for the starting position of Black's knights.

Definition at line 280 of file Masks.hpp.

◆ KNIGHTS [2/2]

auto chess::board::masks::starting::white::KNIGHTS = 0X42_bb
inlineconstexpr

A bitboard mask for the starting position of White's knights.

Definition at line 247 of file Masks.hpp.

◆ LIGHT_SQUARES

auto chess::board::masks::LIGHT_SQUARES = 0x55AA55AA55AA55AA_bb
inlineconstexpr

A bitboard with all the light squares set to 1.

Definition at line 58 of file Masks.hpp.

◆ MAIN_ANTIDIAGONAL

auto chess::board::masks::MAIN_ANTIDIAGONAL = 0x0102040810204080_bb
inlineconstexpr

A bitboard with all squares on the A1-H8 long anti-diagonal set to 1.

Definition at line 64 of file Masks.hpp.

◆ MAIN_DIAGONAL

auto chess::board::masks::MAIN_DIAGONAL = 0x8040201008040201_bb
inlineconstexpr

A bitboard with all squares on the A1-H8 long diagonal set to 1.

Definition at line 61 of file Masks.hpp.

◆ NONE

auto chess::board::masks::NONE = 0X0_bb
inlineconstexpr

A bitboard with all bits set to 0.

Definition at line 52 of file Masks.hpp.

◆ ONE

auto chess::board::masks::ranks::ONE = 0x00000000000000FF_bb
inlineconstexpr

A bitboard with all squares on the first rank set to 1.

Definition at line 189 of file Masks.hpp.

◆ PAWNS [1/2]

auto chess::board::masks::starting::black::PAWNS = ranks::SEVEN
inlineconstexpr

A bitboard mask for the starting position of Black's pawns.

Definition at line 274 of file Masks.hpp.

◆ PAWNS [2/2]

auto chess::board::masks::starting::white::PAWNS = ranks::TWO
inlineconstexpr

A bitboard mask for the starting position of White's pawns.

Definition at line 241 of file Masks.hpp.

◆ PERIMETER

auto chess::board::masks::PERIMETER = 0XFF818181818181FF_bb
inlineconstexpr

A bitboard with all the perimeter squares set to 1.

Definition at line 70 of file Masks.hpp.

◆ QUEEN [1/2]

auto chess::board::masks::starting::black::QUEEN = 0X800000000000000_bb
inlineconstexpr

A bitboard mask for the starting position of Black's queen.

Definition at line 286 of file Masks.hpp.

◆ QUEEN [2/2]

auto chess::board::masks::starting::white::QUEEN = 0X8_bb
inlineconstexpr

A bitboard mask for the starting position of White's queen.

Definition at line 253 of file Masks.hpp.

◆ ROOKS [1/2]

auto chess::board::masks::starting::black::ROOKS = 0X8100000000000000_bb
inlineconstexpr

A bitboard mask for the starting position of Black's rooks.

Definition at line 277 of file Masks.hpp.

◆ ROOKS [2/2]

auto chess::board::masks::starting::white::ROOKS = 0X81_bb
inlineconstexpr

A bitboard mask for the starting position of White's rooks.

Definition at line 244 of file Masks.hpp.

◆ SEVEN

auto chess::board::masks::ranks::SEVEN = 0XFF000000000000_bb
inlineconstexpr

A bitboard with all squares on the seventh rank set to 1.

Definition at line 207 of file Masks.hpp.

◆ SIX

auto chess::board::masks::ranks::SIX = 0XFF0000000000_bb
inlineconstexpr

A bitboard with all squares on the sixth rank set to 1.

Definition at line 204 of file Masks.hpp.

◆ THREE

auto chess::board::masks::ranks::THREE = 0XFF0000_bb
inlineconstexpr

A bitboard with all squares on the third rank set to 1.

Definition at line 195 of file Masks.hpp.

◆ TWO

auto chess::board::masks::ranks::TWO = 0XFF00_bb
inlineconstexpr

A bitboard with all squares on the second rank set to 1.

Definition at line 192 of file Masks.hpp.