|
BenBot 1.7.5
A chess engine
|
#include <libchess/board/Pieces.hpp>
Public Member Functions | |
| consteval | Pieces () noexcept=default |
| constexpr | Pieces (Color color) noexcept |
| constexpr void | capture_at (Square square) noexcept |
| constexpr auto | free () const noexcept -> Bitboard |
| constexpr auto | get_king_location () const noexcept -> Square |
| constexpr auto | get_piece_on (Square square) const noexcept -> std::optional< PieceType > |
| constexpr auto | get_type (PieceType type) const noexcept -> Bitboard |
| constexpr auto | get_type (PieceType type) noexcept -> Bitboard & |
| constexpr auto | has_bishop_pair () const noexcept -> bool |
| constexpr auto | is_file_half_open (File file) const noexcept -> bool |
| constexpr auto | operator== (const Pieces &) const noexcept -> bool=default |
| constexpr void | our_move (moves::Move move, Color ourColor) noexcept |
| constexpr void | refresh_occupied () noexcept |
| constexpr void | vertical_flip () noexcept |
Public Attributes | |
| Bitboard | bishops |
| Bitboard | king |
| Bitboard | knights |
| Bitboard | occupied |
| Bitboard | pawns |
| Bitboard | queens |
| Bitboard | rooks |
This class encapsulates a bitboard for each piece type. An instance of this class encodes the locations of all pieces for one side.
Definition at line 49 of file Pieces.hpp.
|
explicitconstexprnoexcept |
Creates a Pieces object encoding the starting position for the given side.
Definition at line 148 of file Pieces.hpp.
|
constevaldefaultnoexcept |
Creates an empty Pieces object with none of its bitboards initialized.
|
constexprnoexcept |
Removes the piece on the given square, if any. This method asserts if the square is the location of the king.
Definition at line 251 of file Pieces.hpp.
|
inlinenodiscardconstexprnoexcept |
Returns a bitboard that is the inverse of the bitboard returned by occupied(). The returned bitboard has a bit set if no piece of any type is on that square.
Definition at line 98 of file Pieces.hpp.
|
nodiscardconstexprnoexcept |
Returns the location of the king.
Definition at line 219 of file Pieces.hpp.
|
nodiscardconstexprnoexcept |
Returns the type of the piece on the given square, or nullopt if the square is empty. Note that libchess's bitboard board representation is not optimized for this operation.
Definition at line 226 of file Pieces.hpp.
Returns the bitboard corresponding to the given piece type.
Definition at line 191 of file Pieces.hpp.
Returns the bitboard corresponding to the given piece type.
Definition at line 177 of file Pieces.hpp.
|
nodiscardconstexprnoexcept |
Returns true if this side has at least one bishop on each color complex.
Definition at line 210 of file Pieces.hpp.
|
nodiscardconstexprnoexcept |
Returns true if there are no pawns of this color anywhere on the given file.
Definition at line 205 of file Pieces.hpp.
|
nodiscardconstexprdefaultnoexcept |
Returns true if the two piece sets are identical.
|
constexprnoexcept |
Call this when a move is made by this side to update the piece bitboards.
Definition at line 267 of file Pieces.hpp.
|
constexprnoexcept |
Recalculates the occupied bitboard from each of the piece bitboards.
Definition at line 158 of file Pieces.hpp.
|
constexprnoexcept |
Performs a vertical flip of all piece bitboards and refreshes the occupied bitboard.
Definition at line 163 of file Pieces.hpp.
| Bitboard chess::board::Pieces::bishops |
This bitboard holds the locations of this side's bishops.
Definition at line 63 of file Pieces.hpp.
| Bitboard chess::board::Pieces::king |
This bitboard holds the locations of this side's king.
Definition at line 75 of file Pieces.hpp.
| Bitboard chess::board::Pieces::knights |
This bitboard holds the locations of this side's knights.
Definition at line 60 of file Pieces.hpp.
| Bitboard chess::board::Pieces::occupied |
This bitboard is a composite of all of this side's pieces. This board is kept up to date by the capture_at() and our_move() methods. If you update the individual piece boards manually, you must also update this board, or call refresh_occupied() to flush and repopulate it.
Definition at line 82 of file Pieces.hpp.
| Bitboard chess::board::Pieces::pawns |
This bitboard holds the locations of this side's pawns.
Definition at line 57 of file Pieces.hpp.
| Bitboard chess::board::Pieces::queens |
This bitboard holds the locations of this side's queens.
Definition at line 69 of file Pieces.hpp.
| Bitboard chess::board::Pieces::rooks |
This bitboard holds the locations of this side's rooks.
Definition at line 66 of file Pieces.hpp.