BenBot 1.7.5
A chess engine
Loading...
Searching...
No Matches
chess::board Namespace Reference

Namespaces

namespace  detail
namespace  fills
namespace  flips
namespace  literals
namespace  masks
namespace  shifts

Classes

struct  Bitboard
struct  Pieces
struct  Square

Typedefs

using BitboardIndex = std::uint_fast8_t
using PieceType = pieces::Type

Enumerations

enum class  Color
enum class  Color
enum class  File : BitboardIndex {
  File::A , File::B , File::C , File::D ,
  File::E , File::F , File::G , File::H
}
enum class  Rank : BitboardIndex {
  Rank::One , Rank::Two , Rank::Three , Rank::Four ,
  Rank::Five , Rank::Six , Rank::Seven , Rank::Eight
}

Functions

constexpr auto are_on_same_diagonal (const Square &first, const Square &second) noexcept -> bool
constexpr auto back_rank_for (Color color) noexcept -> Rank
constexpr auto center_manhattan_distance (const Square &square) noexcept -> BitboardIndex
constexpr auto chebyshev_distance (const Square &first, const Square &second) noexcept -> BitboardIndex
constexpr auto file_distance (const Square &first, const Square &second) noexcept -> BitboardIndex
auto file_from_char (char character) -> std::expected< File, std::string >
auto file_to_char (File file) -> char
constexpr auto manhattan_distance (const Square &first, const Square &second) noexcept -> BitboardIndex
template<Color Side>
constexpr auto next_pawn_rank (Rank rank) noexcept -> Rank
consteval auto operator""_bb (const unsigned long long value) noexcept -> Bitboard
constexpr auto operator& (const Bitboard &lhs, const Bitboard &rhs) noexcept -> Bitboard
constexpr auto operator<< (const Bitboard &board, const size_t num) noexcept -> Bitboard
constexpr auto operator>> (const Bitboard &board, const size_t num) noexcept -> Bitboard
constexpr auto operator^ (const Bitboard &lhs, const Bitboard &rhs) noexcept -> Bitboard
constexpr auto operator| (const Bitboard &lhs, const Bitboard &rhs) noexcept -> Bitboard
template<Color Side>
constexpr auto prev_pawn_rank (Rank rank) noexcept -> Rank
constexpr auto rank_distance (const Square &first, const Square &second) noexcept -> BitboardIndex
auto rank_from_char (char character) -> std::expected< Rank, std::string >
constexpr auto rank_to_char (Rank rank) -> char

Variables

constexpr BitboardIndex MAX_BITBOARD_IDX = NUM_SQUARES - UINT8_C(1)
constexpr BitboardIndex NUM_SQUARES = UINT8_C(64)
constexpr auto get_en_passant_captured_square (Square targetSquare, bool isWhite) noexcept -> Square
constexpr auto operator<=> (const Square &first, const Square &second) noexcept -> std::strong_ordering

Detailed Description

This namespace contains classes related to the engine's internal board representation.

Typedef Documentation

◆ PieceType

Definition at line 39 of file Pieces.hpp.

Enumeration Type Documentation

◆ Color [1/2]

enum class chess::pieces::Color : std::uint_fast8_t
strong

This enum identifies the side to move.

Definition at line 29 of file Colors.hpp.

◆ Color [2/2]

enum class chess::pieces::Color : std::uint_fast8_t
strong

This enum identifies the side to move.

Definition at line 29 of file Colors.hpp.

Function Documentation

◆ are_on_same_diagonal()

auto chess::board::are_on_same_diagonal ( const Square & first,
const Square & second ) -> bool
related

Definition at line 161 of file Distances.hpp.

◆ center_manhattan_distance()

auto chess::board::center_manhattan_distance ( const Square & square) -> BitboardIndex
related

Definition at line 175 of file Distances.hpp.

◆ chebyshev_distance()

auto chess::board::chebyshev_distance ( const Square & first,
const Square & second ) -> BitboardIndex
related

Definition at line 188 of file Distances.hpp.

◆ file_distance()

auto chess::board::file_distance ( const Square & first,
const Square & second ) -> BitboardIndex
related

Definition at line 137 of file Distances.hpp.

◆ get_en_passant_captured_square()

auto chess::board::get_en_passant_captured_square ( Square targetSquare,
bool isWhite ) -> Square
nodiscardconstexprnoexcept

Given the en passant target square, this returns the square that the captured pawn was on.

Definition at line 260 of file Square.hpp.

◆ manhattan_distance()

auto chess::board::manhattan_distance ( const Square & first,
const Square & second ) -> BitboardIndex
related

Definition at line 168 of file Distances.hpp.

◆ operator&()

auto chess::board::operator& ( const Bitboard & lhs,
const Bitboard & rhs ) -> Bitboard
related

Definition at line 362 of file Bitboard.hpp.

◆ operator<<()

auto chess::board::operator<< ( const Bitboard & board,
const size_t num ) -> Bitboard
related

Definition at line 383 of file Bitboard.hpp.

◆ operator>>()

auto chess::board::operator>> ( const Bitboard & board,
const size_t num ) -> Bitboard
related

Definition at line 390 of file Bitboard.hpp.

◆ operator^()

auto chess::board::operator^ ( const Bitboard & lhs,
const Bitboard & rhs ) -> Bitboard
related

Definition at line 376 of file Bitboard.hpp.

◆ operator|()

auto chess::board::operator| ( const Bitboard & lhs,
const Bitboard & rhs ) -> Bitboard
related

Definition at line 369 of file Bitboard.hpp.

◆ rank_distance()

auto chess::board::rank_distance ( const Square & first,
const Square & second ) -> BitboardIndex
related

Definition at line 149 of file Distances.hpp.