|
BenBot 1.7.5
A chess engine
|
Topics | |
| Bitboard masks | |
Files | |
| file | Bitboard.hpp |
| file | BitboardIndex.hpp |
| file | Distances.hpp |
| file | File.hpp |
| file | Fills.hpp |
| file | Flips.hpp |
| file | Pieces.hpp |
| file | Rank.hpp |
| file | Shifts.hpp |
| file | Square.hpp |
Namespaces | |
| namespace | chess |
| namespace | chess::board |
| namespace | chess::board::fills |
| namespace | chess::board::flips |
| namespace | chess::board::literals |
| namespace | chess::board::shifts |
Classes | |
| struct | chess::board::Bitboard |
| struct | std::formatter< chess::board::File > |
| struct | std::formatter< chess::board::Rank > |
| struct | std::formatter< chess::board::Square > |
| struct | chess::board::Pieces |
| struct | chess::board::Square |
Typedefs | |
| using | chess::board::BitboardIndex = std::uint_fast8_t |
Enumerations | |
| enum class | chess::board::File : BitboardIndex { chess::board::File::A , chess::board::File::B , chess::board::File::C , chess::board::File::D , chess::board::File::E , chess::board::File::F , chess::board::File::G , chess::board::File::H } |
| enum class | chess::board::Rank : BitboardIndex { chess::board::Rank::One , chess::board::Rank::Two , chess::board::Rank::Three , chess::board::Rank::Four , chess::board::Rank::Five , chess::board::Rank::Six , chess::board::Rank::Seven , chess::board::Rank::Eight } |
Functions | |
| constexpr auto | chess::board::back_rank_for (Color color) noexcept -> Rank |
| auto | chess::board::file_from_char (char character) -> std::expected< File, std::string > |
| auto | chess::board::file_to_char (File file) -> char |
| constexpr auto | chess::board::flips::horizontal (Bitboard board) noexcept -> Bitboard |
| template<Color Side> | |
| constexpr auto | chess::board::next_pawn_rank (Rank rank) noexcept -> Rank |
| consteval auto | operator""_bb (const unsigned long long value) noexcept -> Bitboard |
| template<Color Side> | |
| constexpr auto | chess::board::prev_pawn_rank (Rank rank) noexcept -> Rank |
| auto | chess::board::rank_from_char (char character) -> std::expected< Rank, std::string > |
| constexpr auto | chess::board::rank_to_char (Rank rank) -> char |
| constexpr auto | chess::board::flips::vertical (Bitboard board) noexcept -> Bitboard |
Variables | |
| constexpr BitboardIndex | chess::board::MAX_BITBOARD_IDX = NUM_SQUARES - UINT8_C(1) |
| constexpr BitboardIndex | chess::board::NUM_SQUARES = UINT8_C(64) |
| constexpr auto | chess::board::fills::north (Bitboard starting) noexcept -> Bitboard |
| constexpr auto | chess::board::fills::south (Bitboard starting) noexcept -> Bitboard |
| constexpr auto | chess::board::fills::east (Bitboard starting) noexcept -> Bitboard |
| constexpr auto | chess::board::fills::west (Bitboard starting) noexcept -> Bitboard |
| constexpr auto | chess::board::fills::northeast (Bitboard starting) noexcept -> Bitboard |
| constexpr auto | chess::board::fills::southeast (Bitboard starting) noexcept -> Bitboard |
| constexpr auto | chess::board::fills::northwest (Bitboard starting) noexcept -> Bitboard |
| constexpr auto | chess::board::fills::southwest (Bitboard starting) noexcept -> Bitboard |
| constexpr auto | chess::board::fills::file (Bitboard starting) noexcept -> Bitboard |
| constexpr auto | chess::board::fills::rank (Bitboard starting) noexcept -> Bitboard |
| constexpr auto | chess::board::fills::diagonal (Bitboard starting) noexcept -> Bitboard |
| constexpr auto | chess::board::fills::antidiagonal (Bitboard starting) noexcept -> Bitboard |
| template<Color Side> | |
| constexpr auto | chess::board::fills::pawn_front (Bitboard starting) noexcept -> Bitboard |
| template<Color Side> | |
| constexpr auto | chess::board::fills::pawn_rear (Bitboard starting) noexcept -> Bitboard |
| constexpr auto | chess::board::shifts::north (Bitboard board) noexcept -> Bitboard |
| constexpr auto | chess::board::shifts::south (Bitboard board) noexcept -> Bitboard |
| constexpr auto | chess::board::shifts::east (Bitboard board) noexcept -> Bitboard |
| constexpr auto | chess::board::shifts::west (Bitboard board) noexcept -> Bitboard |
| constexpr auto | chess::board::shifts::northeast (Bitboard board) noexcept -> Bitboard |
| constexpr auto | chess::board::shifts::northwest (Bitboard board) noexcept -> Bitboard |
| constexpr auto | chess::board::shifts::southeast (Bitboard board) noexcept -> Bitboard |
| constexpr auto | chess::board::shifts::southwest (Bitboard board) noexcept -> Bitboard |
| template<Color Side> | |
| constexpr auto | chess::board::shifts::pawn_forward (Bitboard board) noexcept -> Bitboard |
| template<Color Side> | |
| constexpr auto | chess::board::shifts::pawn_backward (Bitboard board) noexcept -> Bitboard |
| template<Color Side> | |
| constexpr auto | chess::board::shifts::pawn_capture_east (Bitboard board) noexcept -> Bitboard |
| template<Color Side> | |
| constexpr auto | chess::board::shifts::pawn_capture_west (Bitboard board) noexcept -> Bitboard |
| template<Color Side> | |
| constexpr auto | chess::board::shifts::pawn_inv_capture_east (Bitboard board) noexcept -> Bitboard |
| template<Color Side> | |
| constexpr auto | chess::board::shifts::pawn_inv_capture_west (Bitboard board) noexcept -> Bitboard |
| constexpr auto | operator& (const Bitboard &lhs, const Bitboard &rhs) noexcept -> Bitboard |
| constexpr auto | operator| (const Bitboard &lhs, const Bitboard &rhs) noexcept -> Bitboard |
| constexpr auto | operator^ (const Bitboard &lhs, const Bitboard &rhs) noexcept -> Bitboard |
| constexpr auto | operator<< (const Bitboard &board, size_t num) noexcept -> Bitboard |
| constexpr auto | operator>> (const Bitboard &board, size_t num) noexcept -> Bitboard |
| auto | print_ascii (Bitboard board) -> std::string |
| constexpr auto | operator| (const Bitboard &lhs, const Bitboard &rhs) noexcept -> Bitboard |
| constexpr auto | operator^ (const Bitboard &lhs, const Bitboard &rhs) noexcept -> Bitboard |
| constexpr auto | operator<< (const Bitboard &board, size_t num) noexcept -> Bitboard |
| constexpr auto | operator>> (const Bitboard &board, size_t num) noexcept -> Bitboard |
| auto | print_ascii (Bitboard board) -> std::string |
| constexpr auto | operator| (const Bitboard &lhs, const Bitboard &rhs) noexcept -> Bitboard |
| constexpr auto | operator^ (const Bitboard &lhs, const Bitboard &rhs) noexcept -> Bitboard |
| constexpr auto | operator<< (const Bitboard &board, size_t num) noexcept -> Bitboard |
| constexpr auto | operator>> (const Bitboard &board, size_t num) noexcept -> Bitboard |
| auto | print_ascii (Bitboard board) -> std::string |
| constexpr auto | operator| (const Bitboard &lhs, const Bitboard &rhs) noexcept -> Bitboard |
| constexpr auto | operator^ (const Bitboard &lhs, const Bitboard &rhs) noexcept -> Bitboard |
| constexpr auto | operator<< (const Bitboard &board, size_t num) noexcept -> Bitboard |
| constexpr auto | operator>> (const Bitboard &board, size_t num) noexcept -> Bitboard |
| auto | print_ascii (Bitboard board) -> std::string |
| constexpr auto | operator| (const Bitboard &lhs, const Bitboard &rhs) noexcept -> Bitboard |
| constexpr auto | operator^ (const Bitboard &lhs, const Bitboard &rhs) noexcept -> Bitboard |
| constexpr auto | operator<< (const Bitboard &board, size_t num) noexcept -> Bitboard |
| constexpr auto | operator>> (const Bitboard &board, size_t num) noexcept -> Bitboard |
| auto | print_ascii (Bitboard board) -> std::string |
| constexpr auto | operator| (const Bitboard &lhs, const Bitboard &rhs) noexcept -> Bitboard |
| constexpr auto | operator^ (const Bitboard &lhs, const Bitboard &rhs) noexcept -> Bitboard |
| constexpr auto | operator<< (const Bitboard &board, size_t num) noexcept -> Bitboard |
| constexpr auto | operator>> (const Bitboard &board, size_t num) noexcept -> Bitboard |
| auto | print_ascii (Bitboard board) -> std::string |
| constexpr auto | file_distance (const Square &first, const Square &second) noexcept -> BitboardIndex |
| constexpr auto | rank_distance (const Square &first, const Square &second) noexcept -> BitboardIndex |
| constexpr auto | are_on_same_diagonal (const Square &first, const Square &second) noexcept -> bool |
| constexpr auto | manhattan_distance (const Square &first, const Square &second) noexcept -> BitboardIndex |
| constexpr auto | center_manhattan_distance (const Square &square) noexcept -> BitboardIndex |
| constexpr auto | chebyshev_distance (const Square &first, const Square &second) noexcept -> BitboardIndex |
| auto | knight_distance (const Square &first, const Square &second) -> BitboardIndex |
| constexpr auto | rank_distance (const Square &first, const Square &second) noexcept -> BitboardIndex |
| constexpr auto | are_on_same_diagonal (const Square &first, const Square &second) noexcept -> bool |
| constexpr auto | manhattan_distance (const Square &first, const Square &second) noexcept -> BitboardIndex |
| constexpr auto | center_manhattan_distance (const Square &square) noexcept -> BitboardIndex |
| constexpr auto | chebyshev_distance (const Square &first, const Square &second) noexcept -> BitboardIndex |
| auto | knight_distance (const Square &first, const Square &second) -> BitboardIndex |
| constexpr auto | rank_distance (const Square &first, const Square &second) noexcept -> BitboardIndex |
| constexpr auto | are_on_same_diagonal (const Square &first, const Square &second) noexcept -> bool |
| constexpr auto | manhattan_distance (const Square &first, const Square &second) noexcept -> BitboardIndex |
| constexpr auto | center_manhattan_distance (const Square &square) noexcept -> BitboardIndex |
| constexpr auto | chebyshev_distance (const Square &first, const Square &second) noexcept -> BitboardIndex |
| auto | knight_distance (const Square &first, const Square &second) -> BitboardIndex |
| constexpr auto | rank_distance (const Square &first, const Square &second) noexcept -> BitboardIndex |
| constexpr auto | are_on_same_diagonal (const Square &first, const Square &second) noexcept -> bool |
| constexpr auto | manhattan_distance (const Square &first, const Square &second) noexcept -> BitboardIndex |
| constexpr auto | center_manhattan_distance (const Square &square) noexcept -> BitboardIndex |
| constexpr auto | chebyshev_distance (const Square &first, const Square &second) noexcept -> BitboardIndex |
| auto | knight_distance (const Square &first, const Square &second) -> BitboardIndex |
| constexpr auto | operator<=> (const Square &first, const Square &second) noexcept -> std::strong_ordering |
Classes related to the engine's internal board representation. libchess uses bitboards with "Least Significant File" encoding.
| using chess::board::BitboardIndex = std::uint_fast8_t |
Unsigned integer type used for bitboard indices. Valid bitboard indices are in the range [0, 63].
Definition at line 32 of file BitboardIndex.hpp.
|
strong |
This enum describes the files of the chess board.
|
strong |
This enum describes the ranks of the chessboard.
Returns true if two squares are on the same diagonal of the chessboard. Two squares are on the same diagonal if their file distance equals their rank distance.
Definition at line 161 of file Distances.hpp.
Returns true if two squares are on the same diagonal of the chessboard. Two squares are on the same diagonal if their file distance equals their rank distance.
Definition at line 161 of file Distances.hpp.
Returns true if two squares are on the same diagonal of the chessboard. Two squares are on the same diagonal if their file distance equals their rank distance.
Definition at line 161 of file Distances.hpp.
Returns true if two squares are on the same diagonal of the chessboard. Two squares are on the same diagonal if their file distance equals their rank distance.
Definition at line 161 of file Distances.hpp.
|
Returns the smallest Manhattan distance from the given square to any of the four central squares. The maximum value is 6, from each of the 4 corners.
Definition at line 175 of file Distances.hpp.
|
Returns the smallest Manhattan distance from the given square to any of the four central squares. The maximum value is 6, from each of the 4 corners.
Definition at line 175 of file Distances.hpp.
|
Returns the smallest Manhattan distance from the given square to any of the four central squares. The maximum value is 6, from each of the 4 corners.
Definition at line 175 of file Distances.hpp.
|
Returns the smallest Manhattan distance from the given square to any of the four central squares. The maximum value is 6, from each of the 4 corners.
Definition at line 175 of file Distances.hpp.
|
Returns the Chebyshev distance between the two squares.
Chebyshev distance is the number of king moves required to travel between the squares on an otherwise-empty board. The difference with Manhattan distance is that diagonal king moves are considered.
The maximum Chebyshev distance is 7.
Definition at line 188 of file Distances.hpp.
|
Returns the Chebyshev distance between the two squares.
Chebyshev distance is the number of king moves required to travel between the squares on an otherwise-empty board. The difference with Manhattan distance is that diagonal king moves are considered.
The maximum Chebyshev distance is 7.
Definition at line 188 of file Distances.hpp.
|
Returns the Chebyshev distance between the two squares.
Chebyshev distance is the number of king moves required to travel between the squares on an otherwise-empty board. The difference with Manhattan distance is that diagonal king moves are considered.
The maximum Chebyshev distance is 7.
Definition at line 188 of file Distances.hpp.
|
Returns the Chebyshev distance between the two squares.
Chebyshev distance is the number of king moves required to travel between the squares on an otherwise-empty board. The difference with Manhattan distance is that diagonal king moves are considered.
The maximum Chebyshev distance is 7.
Definition at line 188 of file Distances.hpp.
Shifts all bits in the given board east (i.e., right one file).
Definition at line 119 of file Shifts.hpp.
|
Returns as an integer the distance between the file of the first square and the file of the second square.
The maximum file distance is 7.
Definition at line 137 of file Distances.hpp.
|
inlinenodiscard |
|
inlinenodiscard |
|
Returns the knight distance between the two squares; that is, the number of moves a knight requires to maneuver from first to second.
The maximum knight distance is 6.
|
Returns the knight distance between the two squares; that is, the number of moves a knight requires to maneuver from first to second.
The maximum knight distance is 6.
|
Returns the knight distance between the two squares; that is, the number of moves a knight requires to maneuver from first to second.
The maximum knight distance is 6.
|
Returns the knight distance between the two squares; that is, the number of moves a knight requires to maneuver from first to second.
The maximum knight distance is 6.
|
Returns the Manhattan distance between the two squares.
Manhattan distance is the sum of the rank distance and file distance between the two squares. Therefore, this gives the number of non-diagonal king moves required to travel between the two squares.
The maximum Manhattan distance (between the ends of the long diagonals) is 14.
This may also be known as "taxicab" distance.
Definition at line 168 of file Distances.hpp.
|
Returns the Manhattan distance between the two squares.
Manhattan distance is the sum of the rank distance and file distance between the two squares. Therefore, this gives the number of non-diagonal king moves required to travel between the two squares.
The maximum Manhattan distance (between the ends of the long diagonals) is 14.
This may also be known as "taxicab" distance.
Definition at line 168 of file Distances.hpp.
|
Returns the Manhattan distance between the two squares.
Manhattan distance is the sum of the rank distance and file distance between the two squares. Therefore, this gives the number of non-diagonal king moves required to travel between the two squares.
The maximum Manhattan distance (between the ends of the long diagonals) is 14.
This may also be known as "taxicab" distance.
Definition at line 168 of file Distances.hpp.
|
Returns the Manhattan distance between the two squares.
Manhattan distance is the sum of the rank distance and file distance between the two squares. Therefore, this gives the number of non-diagonal king moves required to travel between the two squares.
The maximum Manhattan distance (between the ends of the long diagonals) is 14.
This may also be known as "taxicab" distance.
Definition at line 168 of file Distances.hpp.
Shifts all bits in the given board north (i.e., up one rank).
Definition at line 109 of file Shifts.hpp.
Shifts all bits in the given board northeast.
Definition at line 133 of file Shifts.hpp.
Shifts all bits in the given board northwest.
Definition at line 140 of file Shifts.hpp.
|
Creates a bitboard from an integer literal value.
Definition at line 244 of file Bitboard.hpp.
Returns the binary AND of two bitboards.
Definition at line 362 of file Bitboard.hpp.
Returns a copy of the bitboard with a binary shift left applied.
Definition at line 383 of file Bitboard.hpp.
Returns a copy of the bitboard with a binary shift left applied.
Definition at line 383 of file Bitboard.hpp.
Returns a copy of the bitboard with a binary shift left applied.
Definition at line 383 of file Bitboard.hpp.
Returns a copy of the bitboard with a binary shift left applied.
Definition at line 383 of file Bitboard.hpp.
Returns a copy of the bitboard with a binary shift left applied.
Definition at line 383 of file Bitboard.hpp.
Returns a copy of the bitboard with a binary shift left applied.
Definition at line 383 of file Bitboard.hpp.
Orders the two squares based on their bitboard indices.
Definition at line 130 of file Square.hpp.
Returns a copy of the bitboard with a binary shift right applied.
Definition at line 390 of file Bitboard.hpp.
Returns a copy of the bitboard with a binary shift right applied.
Definition at line 390 of file Bitboard.hpp.
Returns a copy of the bitboard with a binary shift right applied.
Definition at line 390 of file Bitboard.hpp.
Returns a copy of the bitboard with a binary shift right applied.
Definition at line 390 of file Bitboard.hpp.
Returns a copy of the bitboard with a binary shift right applied.
Definition at line 390 of file Bitboard.hpp.
Returns a copy of the bitboard with a binary shift right applied.
Definition at line 390 of file Bitboard.hpp.
Returns the binary XOR of two bitboards.
Definition at line 376 of file Bitboard.hpp.
Returns the binary XOR of two bitboards.
Definition at line 376 of file Bitboard.hpp.
Returns the binary XOR of two bitboards.
Definition at line 376 of file Bitboard.hpp.
Returns the binary XOR of two bitboards.
Definition at line 376 of file Bitboard.hpp.
Returns the binary XOR of two bitboards.
Definition at line 376 of file Bitboard.hpp.
Returns the binary XOR of two bitboards.
Definition at line 376 of file Bitboard.hpp.
Returns the binary OR of two bitboards.
Definition at line 369 of file Bitboard.hpp.
Returns the binary OR of two bitboards.
Definition at line 369 of file Bitboard.hpp.
Returns the binary OR of two bitboards.
Definition at line 369 of file Bitboard.hpp.
Returns the binary OR of two bitboards.
Definition at line 369 of file Bitboard.hpp.
Returns the binary OR of two bitboards.
Definition at line 369 of file Bitboard.hpp.
Returns the binary OR of two bitboards.
Definition at line 369 of file Bitboard.hpp.
|
nodiscardconstexprnoexcept |
Shifts all pawn positions in the starting bitboard backwards, from the given side's perspective.
Definition at line 171 of file Shifts.hpp.
|
nodiscardconstexprnoexcept |
Shifts all bits in the given bitboard to the east capturing direction for the given side.
Definition at line 180 of file Shifts.hpp.
|
nodiscardconstexprnoexcept |
Shifts all bits in the given bitboard to the west capturing direction for the given side.
Definition at line 198 of file Shifts.hpp.
|
nodiscardconstexprnoexcept |
Shifts all pawn positions in the starting bitboard forward, from the given side's perspective.
Definition at line 162 of file Shifts.hpp.
|
nodiscardconstexprnoexcept |
The inverse operation of pawn_capture_east(). Given a set of target squares, this function returns the set of squares that pawns must start from in order to reach the target squares by capturing east.
Definition at line 189 of file Shifts.hpp.
|
nodiscardconstexprnoexcept |
The inverse operation of pawn_capture_west(). Given a set of target squares, this function returns the set of squares that pawns must start from in order to reach the target squares by capturing west.
Definition at line 207 of file Shifts.hpp.
|
Creates an ASCII representation of the given bitboard. The returned string is meant to be interpreted visually by a human, probably for debugging purposes. The bitboard is drawn as a simple set of cells separated by | characters. Occupied squares have an x placed in them.
|
Creates an ASCII representation of the given bitboard. The returned string is meant to be interpreted visually by a human, probably for debugging purposes. The bitboard is drawn as a simple set of cells separated by | characters. Occupied squares have an x placed in them.
|
Creates an ASCII representation of the given bitboard. The returned string is meant to be interpreted visually by a human, probably for debugging purposes. The bitboard is drawn as a simple set of cells separated by | characters. Occupied squares have an x placed in them.
|
Creates an ASCII representation of the given bitboard. The returned string is meant to be interpreted visually by a human, probably for debugging purposes. The bitboard is drawn as a simple set of cells separated by | characters. Occupied squares have an x placed in them.
|
Creates an ASCII representation of the given bitboard. The returned string is meant to be interpreted visually by a human, probably for debugging purposes. The bitboard is drawn as a simple set of cells separated by | characters. Occupied squares have an x placed in them.
|
Creates an ASCII representation of the given bitboard. The returned string is meant to be interpreted visually by a human, probably for debugging purposes. The bitboard is drawn as a simple set of cells separated by | characters. Occupied squares have an x placed in them.
|
Returns as an integer the distance between the rank of the first square and the rank of the second square.
The maximum rank distance is 7.
Definition at line 149 of file Distances.hpp.
|
Returns as an integer the distance between the rank of the first square and the rank of the second square.
The maximum rank distance is 7.
Definition at line 149 of file Distances.hpp.
|
Returns as an integer the distance between the rank of the first square and the rank of the second square.
The maximum rank distance is 7.
Definition at line 149 of file Distances.hpp.
|
Returns as an integer the distance between the rank of the first square and the rank of the second square.
The maximum rank distance is 7.
Definition at line 149 of file Distances.hpp.
|
inlinenodiscard |
|
nodiscardconstexpr |
Shifts all bits in the given board south (i.e., down one rank).
Definition at line 114 of file Shifts.hpp.
Shifts all bits in the given board southeast.
Definition at line 147 of file Shifts.hpp.
Shifts all bits in the given board southwest.
Definition at line 154 of file Shifts.hpp.
Shifts all bits in the given board west (i.e., left one file).
Definition at line 126 of file Shifts.hpp.
|
inlineconstexpr |
The maximum valid bitboard bit index.
Definition at line 46 of file BitboardIndex.hpp.
|
inlineconstexpr |
The number of squares on a chessboard.
Definition at line 39 of file BitboardIndex.hpp.