HooverChessUtils_PgnReader 0.9.0
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
hoover_chess_utils::pgn_reader Namespace Reference

Namespaces

namespace  unit_test
 

Classes

struct  AllLegalDestinationType
 
class  Attacks
 Piece attack tables. More...
 
class  Attacks_AArch64_SVE2_BitPerm
 Slider attacks implementation using PEXT/PDEP. More...
 
class  Attacks_AVX512F
 
class  Attacks_BlackMagic
 Slider attacks implementation using Elementary Bitboards. More...
 
class  Attacks_BMI2
 Slider attacks implementation using PEXT/PDEP. More...
 
class  Attacks_Elementary_Bitboards
 Slider attacks implementation using Elementary Bitboards. More...
 
class  Attacks_Portable
 Portable implementations for attacks. More...
 
struct  BitBoard
 Board representation using SquareSets (bit boards) More...
 
struct  BitBoardTables
 
struct  BitTricks
 Collection of bit tricks for 64-bit words. More...
 
struct  CastlingSideSpecificsTempl
 
struct  CastlingSideSpecificsTempl< false >
 
struct  CastlingSideSpecificsTempl< true >
 
class  ChessBoard
 The chessboard. More...
 
class  CompactMove
 Compact representation of Move More...
 
struct  CompressedPosition_FixedLength
 A position encoded in 192 bits. More...
 
struct  DummyMoveIteratorDereference
 
class  Intercepts
 Check interceptions and pin checks. More...
 
struct  IteratorStoreMoveFn
 
class  LegalMoveCounterIterator
 
class  LegalMoveDetectorIterator
 
class  MiniString
 A Pascal-style length-prefixed string with the specified maximum length. More...
 
struct  MiniString_Uninitialized
 Tag for unitialized storage. This is a tiny optimization to save a single write when constructing a MiniString. More...
 
class  Move
 A legal move. Important: see the note! More...
 
struct  MoveGenFunctions
 Move generator functions. More...
 
class  MoveGenFunctionTables
 
struct  MoveGenIteratorTraits
 
struct  MoveGenIteratorTraits< LegalMoveCounterIterator >
 
struct  MoveGenIteratorTraits< LegalMoveDetectorIterator >
 
struct  MoveGenIteratorTraits< MoveList::iterator >
 
struct  ParametrizedLegalDestinationType
 
class  PawnLookups
 
struct  PawnLookups_SideSpecificsTempl
 
struct  PawnLookups_SideSpecificsTempl< Color::BLACK >
 
struct  PawnLookups_SideSpecificsTempl< Color::WHITE >
 
class  PgnError
 PGN error exception. More...
 
struct  PgnErrorInfo
 Additional error info. More...
 
class  PgnParser
 The PGN parser. More...
 
class  PgnParser_NullActions
 PGN parser null semantic actions. This is useful only for testing and documentation purposes. More...
 
class  PgnReader
 The PGN reader interface. More...
 
class  PgnReaderActionCompileTimeFilter
 PGN reader action filter (compile-time) More...
 
class  PgnReaderActionFilter
 PGN reader action filter. More...
 
class  PgnReaderActions
 Semantic actions for reading a PGN. The caller is expected to inherit this class and override all callbacks of interest. More...
 
class  PgnScanner
 The PGN scanner (lexer) More...
 
union  PgnScannerTokenInfo
 Union of all additional scanner information. The applicable union member depends the PGN scanner token (see PgnScannerToken). More...
 
struct  PgnScannerTokenInfo_ERROR
 Additional token info for error token. More...
 
struct  PgnScannerTokenInfo_MOVENUM
 Additional token info for move number token. More...
 
struct  PgnScannerTokenInfo_NAG
 Additional token info for numeric annotation glyph. More...
 
struct  PgnScannerTokenInfo_PAWN_MOVE
 Additional token info for pawn move. More...
 
struct  PgnScannerTokenInfo_PIECE_MOVE
 Additional token info for piece move. More...
 
struct  PgnScannerTokenInfo_RESULT
 Additional token info for game result. More...
 
class  PositionCompressor_FixedLength
 Position compressor that produces fixed-length output (192 bits). More...
 
struct  SingleMoveStoreMoveFn
 
struct  SingleMoveStoreMoveNoDupCheckFn
 
class  SquareSet
 Set of squares. Implemented using a bit-mask. More...
 
class  StringBuilder
 
class  StringUtils
 Miscellaneous string utilities. More...
 

Typedefs

using SquareUnderlyingType = std::uint_fast8_t
 Underlying type of Square
 
using SquareCompactType = std::uint8_t
 Compact type for Square. The compact type can store all legal enumeration values.
 
using ColorUnderlyingType = std::uint_fast8_t
 Underlying type of Color
 
using ColorCompactType = std::uint8_t
 Compact type for Color. The compact type can store all legal enumeration values.
 
using PieceUnderlyingType = std::uint_fast8_t
 Underlying type of Piece
 
using PieceCompactType = std::uint8_t
 Compact type for Piece. The compact type can store all legal enumeration values.
 
using PieceAndColorUnderlyingType = std::uint_fast8_t
 Underlying type of PieceAndColor
 
using PieceAndColorCompactType = std::uint8_t
 Compact type for PieceAndColor. The compact type can store all legal enumeration values.
 
using PositionStatusUnderlyingType = std::uint_fast8_t
 Underlying type of PositionStatus
 
using PositionStatusCompactType = std::uint8_t
 Compact type for PositionStatus. The compact type can store all legal enumeration values.
 
using RowColumnUnderlyingType = std::uint_fast8_t
 Underlying type of RowColumn
 
using RowColumnCompactType = std::uint8_t
 Compact type for RowColumn. The compact type can store all legal enumeration values.
 
using RowColumn = RowColumnUnderlyingType
 Row/column coordinate type. Valid range: [0, 7] signifying ranks 1–8 (as rows) or files A–H (as columns). The numbering is always from White's point of view.
 
using ArrayBoard = std::array< PieceAndColorCompact, 64U >
 Board representation using an array.
 
using MoveTypeAndPromotionUnderlyingType = std::uint_fast8_t
 Underlying type of MoveTypeAndPromotion
 
using MoveList = std::array< CompactMove, 256U >
 Move list returned by ChessBoard::generateMoves().
 
using ShortMoveList = std::array< CompactMove, 8U >
 Short move list returned by move generators for writing a SAN move. That is, when the piece type and destination square are known, and moves need to be generated to resolve the required disambiguation.
 
using FenString = MiniString< 96U >
 MiniString containing a FEN.
 

Enumerations

enum class  Square : SquareUnderlyingType {
  Square::A1 = 0U , Square::B1 = 1U , Square::C1 = 2U , Square::D1 = 3U ,
  Square::E1 = 4U , Square::F1 = 5U , Square::G1 = 6U , Square::H1 = 7U ,
  Square::A2 = 8U , Square::B2 = 9U , Square::C2 = 10U , Square::D2 = 11U ,
  Square::E2 = 12U , Square::F2 = 13U , Square::G2 = 14U , Square::H2 = 15U ,
  Square::A3 = 16U , Square::B3 = 17U , Square::C3 = 18U , Square::D3 = 19U ,
  Square::E3 = 20U , Square::F3 = 21U , Square::G3 = 22U , Square::H3 = 23U ,
  Square::A4 = 24U , Square::B4 = 25U , Square::C4 = 26U , Square::D4 = 27U ,
  Square::E4 = 28U , Square::F4 = 29U , Square::G4 = 30U , Square::H4 = 31U ,
  Square::A5 = 32U , Square::B5 = 33U , Square::C5 = 34U , Square::D5 = 35U ,
  Square::E5 = 36U , Square::F5 = 37U , Square::G5 = 38U , Square::H5 = 39U ,
  Square::A6 = 40U , Square::B6 = 41U , Square::C6 = 42U , Square::D6 = 43U ,
  Square::E6 = 44U , Square::F6 = 45U , Square::G6 = 46U , Square::H6 = 47U ,
  Square::A7 = 48U , Square::B7 = 49U , Square::C7 = 50U , Square::D7 = 51U ,
  Square::E7 = 52U , Square::F7 = 53U , Square::G7 = 54U , Square::H7 = 55U ,
  Square::A8 = 56U , Square::B8 = 57U , Square::C8 = 58U , Square::D8 = 59U ,
  Square::E8 = 60U , Square::F8 = 61U , Square::G8 = 62U , Square::H8 = 63U ,
  Square::NONE = 64U
}
 Named square. More...
 
enum class  Color : ColorUnderlyingType { Color::WHITE = 0U , Color::BLACK = 8U }
 Color of a piece or side to move. More...
 
enum class  Piece : PieceUnderlyingType {
  Piece::NONE = 0U , Piece::PAWN , Piece::KNIGHT , Piece::BISHOP ,
  Piece::ROOK , Piece::QUEEN , Piece::KING
}
 Named piece. More...
 
enum class  PieceAndColor : PieceAndColorUnderlyingType {
  PieceAndColor::NONE = 0U , PieceAndColor::WHITE_PAWN = 1U , PieceAndColor::WHITE_KNIGHT , PieceAndColor::WHITE_BISHOP ,
  PieceAndColor::WHITE_ROOK , PieceAndColor::WHITE_QUEEN , PieceAndColor::WHITE_KING , PieceAndColor::BLACK_PAWN = 9U ,
  PieceAndColor::BLACK_KNIGHT , PieceAndColor::BLACK_BISHOP , PieceAndColor::BLACK_ROOK , PieceAndColor::BLACK_QUEEN ,
  PieceAndColor::BLACK_KING , PieceAndColor::WHITE_NONE = 0U , PieceAndColor::BLACK_NONE = 8U
}
 Named piece and color. More...
 
enum class  PieceAndColorCompact : PieceAndColorCompactType {
  PieceAndColorCompact::NONE = 0U , PieceAndColorCompact::WHITE_PAWN = 1U , PieceAndColorCompact::WHITE_KNIGHT , PieceAndColorCompact::WHITE_BISHOP ,
  PieceAndColorCompact::WHITE_ROOK , PieceAndColorCompact::WHITE_QUEEN , PieceAndColorCompact::WHITE_KING , PieceAndColorCompact::BLACK_PAWN = 9U ,
  PieceAndColorCompact::BLACK_KNIGHT , PieceAndColorCompact::BLACK_BISHOP , PieceAndColorCompact::BLACK_ROOK , PieceAndColorCompact::BLACK_QUEEN ,
  PieceAndColorCompact::BLACK_KING , PieceAndColorCompact::WHITE_NONE = 0U , PieceAndColorCompact::BLACK_NONE = 8U
}
 Named piece and color (compact representation) More...
 
enum class  PositionStatus : PositionStatusUnderlyingType { PositionStatus::NORMAL , PositionStatus::CHECK , PositionStatus::STALEMATE , PositionStatus::MATE }
 Status of a position. More...
 
enum class  MoveTypeAndPromotion : MoveTypeAndPromotionUnderlyingType {
  MoveTypeAndPromotion::REGULAR_PAWN_MOVE = 0U , MoveTypeAndPromotion::REGULAR_KNIGHT_MOVE = 1U , MoveTypeAndPromotion::REGULAR_BISHOP_MOVE = 2U , MoveTypeAndPromotion::REGULAR_ROOK_MOVE = 3U ,
  MoveTypeAndPromotion::REGULAR_QUEEN_MOVE = 4U , MoveTypeAndPromotion::REGULAR_KING_MOVE = 5U , MoveTypeAndPromotion::CASTLING_SHORT = 6U , MoveTypeAndPromotion::CASTLING_LONG = 7U ,
  MoveTypeAndPromotion::PROMO_KNIGHT = 8U , MoveTypeAndPromotion::PROMO_BISHOP = 9U , MoveTypeAndPromotion::PROMO_ROOK = 10U , MoveTypeAndPromotion::PROMO_QUEEN = 11U ,
  MoveTypeAndPromotion::EN_PASSANT = 12U , MoveTypeAndPromotion::ILLEGAL = 15U
}
 Move type (4 bits, range: 0..15) More...
 
enum class  MoveGenType { MoveGenType::NO_CHECK = 0U , MoveGenType::CHECK , MoveGenType::DOUBLE_CHECK }
 Move generator type. More...
 
enum class  PgnErrorCode : unsigned {
  PgnErrorCode::OK = 0U , PgnErrorCode::BAD_CHARACTER = 1U , PgnErrorCode::BAD_PGN_TAG , PgnErrorCode::UNEXPECTED_MOVE_NUM ,
  PgnErrorCode::UNEXPECTED_TOKEN , PgnErrorCode::BAD_FEN , PgnErrorCode::ILLEGAL_MOVE , PgnErrorCode::AMBIGUOUS_MOVE ,
  PgnErrorCode::UNIMPLEMENTED , PgnErrorCode::INTERNAL_ERROR
}
 Error code. More...
 
enum class  PgnResult : std::uint_fast8_t { PgnResult::WHITE_WIN , PgnResult::BLACK_WIN , PgnResult::DRAW , PgnResult::UNKNOWN }
 Game result. More...
 
enum class  PgnReaderOnErrorAction { PgnReaderOnErrorAction::Abort , PgnReaderOnErrorAction::ContinueFromNextGame }
 Action for recoverable PGN reader error. More...
 
enum class  PgnReaderActionClass : unsigned int {
  PgnReaderActionClass::PgnTag = 0U , PgnReaderActionClass::Move , PgnReaderActionClass::NAG , PgnReaderActionClass::Variation ,
  PgnReaderActionClass::Comment
}
 PGN reader filterable action classes. More...
 
enum class  CompressedPosition_PieceEncoding {
  CompressedPosition_PieceEncoding::WHITE_KING_NOT_IN_TURN = 0U , CompressedPosition_PieceEncoding::WHITE_BISHOP = 1U , CompressedPosition_PieceEncoding::WHITE_ROOK_CANNOT_CASTLE = 2U , CompressedPosition_PieceEncoding::WHITE_QUEEN = 3U ,
  CompressedPosition_PieceEncoding::WHITE_KNIGHT = 4U , CompressedPosition_PieceEncoding::WHITE_PAWN = 5U , CompressedPosition_PieceEncoding::WHITE_ROOK_CAN_CASTLE = 6U , CompressedPosition_PieceEncoding::WHITE_KING_IN_TURN = 7U ,
  CompressedPosition_PieceEncoding::EP_PAWN = 8U , CompressedPosition_PieceEncoding::BLACK_BISHOP = 9U , CompressedPosition_PieceEncoding::BLACK_ROOK_CANNOT_CASTLE = 10U , CompressedPosition_PieceEncoding::BLACK_QUEEN = 11U ,
  CompressedPosition_PieceEncoding::BLACK_KNIGHT = 12U , CompressedPosition_PieceEncoding::BLACK_PAWN = 13U , CompressedPosition_PieceEncoding::BLACK_ROOK_CAN_CASTLE = 14U , CompressedPosition_PieceEncoding::BLACK_KING = 15U
}
 Compressed piece encoding for fixed-length compressed position. More...
 
enum  PgnScannerToken : std::uint8_t {
  NONE = 0U , END_OF_FILE , TAG_START , TAG_KEY ,
  TAG_VALUE , TAG_END , VARIATION_START , VARIATION_END ,
  MOVENUM , MOVE_PAWN , MOVE_PAWN_CAPTURE , MOVE_PAWN_PROMO ,
  MOVE_PAWN_PROMO_CAPTURE , MOVE_PIECE_KNIGHT , MOVE_PIECE_BISHOP , MOVE_PIECE_ROOK ,
  MOVE_PIECE_QUEEN , MOVE_PIECE_KING , MOVE_SHORT_CASTLE , MOVE_LONG_CASTLE ,
  NAG , COMMENT_START , COMMENT_TEXT , COMMENT_NEWLINE ,
  COMMENT_END , RESULT , ERROR
}
 PGN scanner token. More...
 

Functions

constexpr bool isValidValue (Square sq) noexcept
 Checks whether a value is a valid enumeration value.
 
constexpr bool isValidSquare (Square sq) noexcept
 Checks whether a value is a square.
 
constexpr Square makeSquare (RowColumn col, RowColumn row) noexcept
 Constructs a square from column and row.
 
constexpr RowColumn columnOf (Square sq) noexcept
 Returns column number of square.
 
constexpr RowColumn rowOf (Square sq) noexcept
 Returns row number of square.
 
constexpr Square getSquareForIndex (std::size_t index) noexcept
 Returns a square for an index. In essence, this is the ordinal of the square.
 
constexpr std::size_t getIndexOfSquare (Square sq) noexcept
 Returns an index for a square.
 
constexpr Square addToSquareNoOverflowCheck (Square sq, std::int_fast8_t shift) noexcept
 Adds to square. This function performs no overflow checking.
 
constexpr bool isValidValue (Color c) noexcept
 Checks whether a value is a valid enumeration value.
 
constexpr Color oppositeColor (Color c) noexcept
 Flips the color.
 
constexpr Color colorOf (PieceAndColor pc) noexcept
 Returns color of a piece.
 
constexpr bool isValidValue (Piece p) noexcept
 Checks whether a value is a valid enumeration value.
 
constexpr bool isValidValue (PieceAndColor pc) noexcept
 Checks whether a value is a valid enumeration value.
 
constexpr Piece pieceOf (PieceAndColor pc) noexcept
 Returns piece of a piece and color enumeration value.
 
constexpr PieceAndColor makePieceAndColor (Piece p, Color c) noexcept
 Constructs a PieceAndColor enumeration value from Piece and Color.
 
constexpr PieceAndColorCompact toCompactType (PieceAndColor pc) noexcept
 Converts PieceAndColor (fast type) to PieceAndColorCompact (compact type).
 
constexpr PieceAndColor toFastType (PieceAndColorCompact pc) noexcept
 Converts PieceAndColorCompact (compact type) to PieceAndColor (fast type).
 
constexpr std::uint_fast32_t makePlyNum (std::uint_fast32_t moveNum, Color color) noexcept
 Computes the ply number from full move number and side to move.
 
constexpr Color colorOfPly (std::uint_fast32_t plyNum) noexcept
 Returns side to move for a ply number.
 
constexpr std::uint_fast32_t moveNumOfPly (std::uint_fast32_t plyNum) noexcept
 Computes the full move for a ply number.
 
auto operator<=> (const CompressedPosition_FixedLength &lhs, const CompressedPosition_FixedLength &rhs) noexcept
 Three-way comparison operator (spaceship). The comparison provides strong ordering.
 
bool operator== (const CompressedPosition_FixedLength &lhs, const CompressedPosition_FixedLength &rhs) noexcept
 Equality comparison operator.
 
constexpr std::string_view getVersionString () noexcept
 
template<typename IteratorType , MoveGenType type, typename ParamType , Color turn>
auto generateMovesForPawnsTempl (const ChessBoard &board, IteratorType i, ParamType legalDestinations) noexcept -> IteratorType
 Generates legal pawn moves, the actual implementation.
 
template<typename IteratorType , MoveGenType type, typename ParamType >
auto generateMovesForPawns (const ChessBoard &board, IteratorType i, ParamType legalDestinations) noexcept -> IteratorType
 Generates legal pawn moves, dispatch for side-to-move.
 
template<typename IteratorType , MoveGenType type, typename ParamType >
auto generateMovesForKnight (const ChessBoard &board, IteratorType i, Square sq, ParamType legalDestinations) noexcept -> IteratorType
 Generates legal knight moves.
 
template<typename IteratorType , MoveGenType type, typename ParamType , bool pinned>
auto generateMovesForBishop (const ChessBoard &board, IteratorType i, Square sq, ParamType legalDestinations, MoveTypeAndPromotion typeAndPromo) noexcept -> IteratorType
 Generates legal bishop moves for queen or bishop.
 
template<typename IteratorType , MoveGenType type, typename ParamType , bool pinned>
auto generateMovesForRook (const ChessBoard &board, IteratorType i, Square sq, ParamType legalDestinations, MoveTypeAndPromotion typeAndPromo) noexcept -> IteratorType
 Generates legal rook moves for queen or rook.
 
template<typename IteratorType >
auto generateMovesForKing (const ChessBoard &board, IteratorType i, SquareSet attackedSquares) noexcept -> IteratorType
 Generates legal king moves.
 
template<typename IteratorType >
IteratorType generateAllLegalMovesTemplNoCheck (const ChessBoard &board, IteratorType i) noexcept
 Generates all legal moves when not in check.
 
template<typename IteratorType >
IteratorType generateAllLegalMovesTemplInCheck (const ChessBoard &board, IteratorType i) noexcept
 Generates all legal moves when in check (but not in double check)
 
template<typename IteratorType >
IteratorType generateAllLegalMovesTemplInDoubleCheck (const ChessBoard &board, IteratorType i) noexcept
 Generates all legal moves when in double check.
 
template<MoveGenType type, typename IteratorType >
IteratorType generateMovesIterTempl (const ChessBoard &board, IteratorType i) noexcept
 Generates all legal moves for a specific iterator type.
 
template<MoveGenType type>
std::size_t generateMovesTempl (const ChessBoard &board, MoveList &moves) noexcept
 Generates all legal moves for a position.
 
template<MoveGenType type>
std::size_t getNumberOfLegalMovesTempl (const ChessBoard &board) noexcept
 Returns the number of legal moves for a position.
 
template<MoveGenType type>
bool hasLegalMovesTempl (const ChessBoard &board) noexcept
 Determines whether there are any legal moves.
 
template<MoveGenType type, typename MoveStoreFn >
void generateMovesForPawnAndDestNoCaptureStoreFnTempl (const ChessBoard &board, SquareSet srcSqMask, Square dst, typename MoveStoreFn::Store &store) noexcept
 
template<MoveGenType type>
Move generateSingleMoveForPawnAndDestNoCaptureTempl (const ChessBoard &board, SquareSet srcSqMask, Square dst) noexcept
 
template<MoveGenType type>
std::size_t generateMovesForPawnAndDestNoCaptureTempl (const ChessBoard &board, ShortMoveList &moves, SquareSet srcSqMask, Square dst) noexcept
 
template<MoveGenType type, typename MoveStoreFn >
void generateMovesForPawnAndDestCaptureStoreFnTempl (const ChessBoard &board, SquareSet srcSqMask, Square dst, typename MoveStoreFn::Store &store) noexcept
 
template<MoveGenType type>
Move generateSingleMoveForPawnAndDestCaptureTempl (const ChessBoard &board, SquareSet srcSqMask, Square dst) noexcept
 
template<MoveGenType type>
std::size_t generateMovesForPawnAndDestCaptureTempl (const ChessBoard &board, ShortMoveList &moves, SquareSet srcSqMask, Square dst) noexcept
 
template<MoveGenType type, typename MoveStoreFn >
void generateMovesForPawnAndDestPromoNoCaptureStoreFnTempl (const ChessBoard &board, SquareSet srcSqMask, Square dst, Piece promo, typename MoveStoreFn::Store &store) noexcept
 
template<MoveGenType type>
Move generateSingleMoveForPawnAndDestPromoNoCaptureTempl (const ChessBoard &board, SquareSet srcSqMask, Square dst, Piece promo) noexcept
 
template<MoveGenType type>
std::size_t generateMovesForPawnAndDestPromoNoCaptureTempl (const ChessBoard &board, ShortMoveList &moves, SquareSet srcSqMask, Square dst, Piece promo) noexcept
 
template<MoveGenType type, typename MoveStoreFn >
void generateMovesForPawnAndDestPromoCaptureStoreFnTempl (const ChessBoard &board, SquareSet srcSqMask, Square dst, Piece promo, typename MoveStoreFn::Store &store) noexcept
 
template<MoveGenType type>
Move generateSingleMoveForPawnAndDestPromoCaptureTempl (const ChessBoard &board, SquareSet srcSqMask, Square dst, Piece promo) noexcept
 
template<MoveGenType type>
std::size_t generateMovesForPawnAndDestPromoCaptureTempl (const ChessBoard &board, ShortMoveList &moves, SquareSet srcSqMask, Square dst, Piece promo) noexcept
 
template<MoveGenType type, typename MoveStoreFn >
void generateMovesForKnightAndDestStoreFnTempl (const ChessBoard &board, SquareSet srcSqMask, Square dst, typename MoveStoreFn::Store &store) noexcept
 
template<MoveGenType type>
Move generateSingleMoveForKnightAndDestTempl (const ChessBoard &board, SquareSet srcSqMask, Square dst) noexcept
 
template<MoveGenType type>
std::size_t generateMovesForKnightAndDestTempl (const ChessBoard &board, ShortMoveList &moves, SquareSet srcSqMask, Square dst) noexcept
 
template<MoveGenType type, MoveTypeAndPromotion moveType, typename MoveStoreFn >
void generateMovesForSliderAndDestStoreFnTempl (const ChessBoard &board, SquareSet srcSqMask, Square dst, typename MoveStoreFn::Store &store) noexcept
 
template<MoveGenType type>
Move generateSingleMoveForBishopAndDestTempl (const ChessBoard &board, SquareSet srcSqMask, Square dst) noexcept
 
template<MoveGenType type>
std::size_t generateMovesForBishopAndDestTempl (const ChessBoard &board, ShortMoveList &moves, SquareSet srcSqMask, Square dst) noexcept
 
template<MoveGenType type>
Move generateSingleMoveForRookAndDestTempl (const ChessBoard &board, SquareSet srcSqMask, Square dst) noexcept
 
template<MoveGenType type>
std::size_t generateMovesForRookAndDestTempl (const ChessBoard &board, ShortMoveList &moves, SquareSet srcSqMask, Square dst) noexcept
 
template<MoveGenType type>
Move generateSingleMoveForQueenAndDestTempl (const ChessBoard &board, SquareSet srcSqMask, Square dst) noexcept
 
template<MoveGenType type>
std::size_t generateMovesForQueenAndDestTempl (const ChessBoard &board, ShortMoveList &moves, SquareSet srcSqMask, Square dst) noexcept
 
template<MoveGenType type, typename MoveStoreFn >
void generateMovesForKingAndDestStoreFnTempl (const ChessBoard &board, SquareSet srcSqMask, Square dst, typename MoveStoreFn::Store &store) noexcept
 
template<MoveGenType type>
Move generateSingleMoveForKingAndDestTempl (const ChessBoard &board, SquareSet srcSqMask, Square dst) noexcept
 
template<MoveGenType type>
std::size_t generateMovesForKingAndDestTempl (const ChessBoard &board, ShortMoveList &moves, SquareSet srcSqMask, Square dst) noexcept
 
template<MoveGenType type>
Move generateSingleMoveForLongCastlingTempl (const ChessBoard &board) noexcept
 
template<MoveGenType type>
std::size_t generateMovesForLongCastlingTempl (const ChessBoard &board, ShortMoveList &moves) noexcept
 
template<MoveGenType type>
Move generateSingleMoveForShortCastlingTempl (const ChessBoard &board) noexcept
 
template<MoveGenType type>
std::size_t generateMovesForShortCastlingTempl (const ChessBoard &board, ShortMoveList &moves) noexcept
 
constexpr MoveTypeAndPromotion pieceToTypeAndPromotion (Piece promotion) noexcept
 
template<MoveGenType type>
SquareSet blocksAllChecksMaskTempl (Square kingSq, SquareSet checkers, Square dst) noexcept
 
template<>
constexpr SquareSet blocksAllChecksMaskTempl< MoveGenType::NO_CHECK > (Square kingSq, SquareSet checkers, Square dst) noexcept
 
template<>
SquareSet blocksAllChecksMaskTempl< MoveGenType::CHECK > (Square kingSq, SquareSet checkers, Square dst) noexcept
 
template<MoveGenType type, typename MoveStoreFn , bool shortCastling>
void generateMovesForCastlingStoreFnTempl (const ChessBoard &board, SquareSet attackedSquares, typename MoveStoreFn::Store &store) noexcept
 Generates the legal castling move, if any.
 
template<typename U64Type >
const U64Type & turnSpecificLookup (const std::array< U64Type, 2U > &array, Color turn) noexcept
 Piece attack tables.
 
template<typename U64Type , std::size_t N>
const U64Type & turnSpecificArrayLookup (const std::array< std::array< U64Type, 2U >, N > &array, std::size_t i, Color turn) noexcept
 Optimized lookup for arrays indexed by general index and turn (side-to-move).
 
constexpr std::uint32_t pgnScannerTokenToMaskBit (PgnScannerToken token) noexcept
 

Variables

const BitBoardTables ctBitBoardTables
 Various bitboard attack and other tables.
 

Typedef Documentation

◆ MoveTypeAndPromotionUnderlyingType

Underlying type of MoveTypeAndPromotion

Function Documentation

◆ blocksAllChecksMaskTempl()

template<MoveGenType type>
SquareSet hoover_chess_utils::pgn_reader::blocksAllChecksMaskTempl ( Square  kingSq,
SquareSet  checkers,
Square  dst 
)
inlinenoexcept

◆ blocksAllChecksMaskTempl< MoveGenType::CHECK >()

template<>
SquareSet hoover_chess_utils::pgn_reader::blocksAllChecksMaskTempl< MoveGenType::CHECK > ( Square  kingSq,
SquareSet  checkers,
Square  dst 
)
inlinenoexcept

◆ blocksAllChecksMaskTempl< MoveGenType::NO_CHECK >()

template<>
constexpr SquareSet hoover_chess_utils::pgn_reader::blocksAllChecksMaskTempl< MoveGenType::NO_CHECK > ( Square  kingSq,
SquareSet  checkers,
Square  dst 
)
inlineconstexprnoexcept

◆ generateAllLegalMovesTemplInCheck()

template<typename IteratorType >
IteratorType hoover_chess_utils::pgn_reader::generateAllLegalMovesTemplInCheck ( const ChessBoard board,
IteratorType  i 
)
inlinenoexcept

Generates all legal moves when in check (but not in double check)

Template Parameters
IteratorTypeMove list iterator type
Parameters
[in]boardChess board
[in]iMove list iterator (begin of list)
Returns
Move list iterator (end of generated moves)
See also
Attacks::determineAttackedSquares()

◆ generateAllLegalMovesTemplInDoubleCheck()

template<typename IteratorType >
IteratorType hoover_chess_utils::pgn_reader::generateAllLegalMovesTemplInDoubleCheck ( const ChessBoard board,
IteratorType  i 
)
inlinenoexcept

Generates all legal moves when in double check.

Template Parameters
IteratorTypeMove list iterator type
Parameters
[in]boardChess board
[in]iMove list iterator (begin of list)
Returns
Move list iterator (end of generated moves)
See also
(Attacks::determineAttackedSquares())

◆ generateAllLegalMovesTemplNoCheck()

template<typename IteratorType >
IteratorType hoover_chess_utils::pgn_reader::generateAllLegalMovesTemplNoCheck ( const ChessBoard board,
IteratorType  i 
)
inlinenoexcept

Generates all legal moves when not in check.

Template Parameters
IteratorTypeMove list iterator type
Parameters
[in]boardChess board
[in]iMove list iterator (begin of list)
Returns
Move list iterator (end of generated moves)
See also
Attacks::determineAttackedSquares()

◆ generateMovesForBishop()

template<typename IteratorType , MoveGenType type, typename ParamType , bool pinned>
auto hoover_chess_utils::pgn_reader::generateMovesForBishop ( const ChessBoard board,
IteratorType  i,
Square  sq,
ParamType  legalDestinations,
MoveTypeAndPromotion  typeAndPromo 
) -> IteratorType
noexcept

Generates legal bishop moves for queen or bishop.

Template Parameters
IteratorTypeMove list iterator type
typeMove generator type
legalDestinationsParameter type for legal destinations
pinnedWhether the piece is pinned
Parameters
[in]boardChess board
[in]iMove list iterator (begin of list)
[in]sqSource square
[in]legalDestinationsLegal destinations
[in]typeAndPromoMoveTypeAndPromotion::REGULAR_BISHOP_MOVE or MoveTypeAndPromotion::REGULAR_QUEEN_MOVE depending on the piece.
Returns
Move list iterator (end of generated moves)

◆ generateMovesForBishopAndDestTempl()

template<MoveGenType type>
std::size_t hoover_chess_utils::pgn_reader::generateMovesForBishopAndDestTempl ( const ChessBoard board,
ShortMoveList moves,
SquareSet  srcSqMask,
Square  dst 
)
noexcept

◆ generateMovesForCastlingStoreFnTempl()

template<MoveGenType type, typename MoveStoreFn , bool shortCastling>
void hoover_chess_utils::pgn_reader::generateMovesForCastlingStoreFnTempl ( const ChessBoard board,
SquareSet  attackedSquares,
typename MoveStoreFn::Store &  store 
)
noexcept

Generates the legal castling move, if any.

Template Parameters
typeMove generator type. Must be MoveGenType::NO_CHECK.
MoveStoreFnMove store function
shortCastlingWhether the move is short castling
Parameters
[in]boardChess board
[in]attackedSquaresAttacked squares
[in]storeMove store target
See also
Attacks::determineAttackedSquares()

◆ generateMovesForKing()

template<typename IteratorType >
auto hoover_chess_utils::pgn_reader::generateMovesForKing ( const ChessBoard board,
IteratorType  i,
SquareSet  attackedSquares 
) -> IteratorType
noexcept

Generates legal king moves.

Template Parameters
IteratorTypeMove list iterator type
typeMove generator type
Parameters
[in]boardChess board
[in]iMove list iterator (begin of list)
[in]attackedSquaresAttacked squares
Returns
Move list iterator (end of generated moves)
See also
Attacks::determineAttackedSquares()

◆ generateMovesForKingAndDestStoreFnTempl()

template<MoveGenType type, typename MoveStoreFn >
void hoover_chess_utils::pgn_reader::generateMovesForKingAndDestStoreFnTempl ( const ChessBoard board,
SquareSet  srcSqMask,
Square  dst,
typename MoveStoreFn::Store &  store 
)
inlinenoexcept

◆ generateMovesForKingAndDestTempl()

template<MoveGenType type>
std::size_t hoover_chess_utils::pgn_reader::generateMovesForKingAndDestTempl ( const ChessBoard board,
ShortMoveList moves,
SquareSet  srcSqMask,
Square  dst 
)
noexcept

◆ generateMovesForKnight()

template<typename IteratorType , MoveGenType type, typename ParamType >
auto hoover_chess_utils::pgn_reader::generateMovesForKnight ( const ChessBoard board,
IteratorType  i,
Square  sq,
ParamType  legalDestinations 
) -> IteratorType
noexcept

Generates legal knight moves.

Template Parameters
IteratorTypeMove list iterator type
typeMove generator type
legalDestinationsParameter type for legal destinations
Parameters
[in]boardChess board
[in]iMove list iterator (begin of list)
[in]sqSource square
[in]legalDestinationsLegal destinations
Returns
Move list iterator (end of generated moves)

◆ generateMovesForKnightAndDestStoreFnTempl()

template<MoveGenType type, typename MoveStoreFn >
void hoover_chess_utils::pgn_reader::generateMovesForKnightAndDestStoreFnTempl ( const ChessBoard board,
SquareSet  srcSqMask,
Square  dst,
typename MoveStoreFn::Store &  store 
)
inlinenoexcept

◆ generateMovesForKnightAndDestTempl()

template<MoveGenType type>
std::size_t hoover_chess_utils::pgn_reader::generateMovesForKnightAndDestTempl ( const ChessBoard board,
ShortMoveList moves,
SquareSet  srcSqMask,
Square  dst 
)
noexcept

◆ generateMovesForLongCastlingTempl()

template<MoveGenType type>
std::size_t hoover_chess_utils::pgn_reader::generateMovesForLongCastlingTempl ( const ChessBoard board,
ShortMoveList moves 
)
noexcept

◆ generateMovesForPawnAndDestCaptureStoreFnTempl()

template<MoveGenType type, typename MoveStoreFn >
void hoover_chess_utils::pgn_reader::generateMovesForPawnAndDestCaptureStoreFnTempl ( const ChessBoard board,
SquareSet  srcSqMask,
Square  dst,
typename MoveStoreFn::Store &  store 
)
inlinenoexcept

◆ generateMovesForPawnAndDestCaptureTempl()

template<MoveGenType type>
std::size_t hoover_chess_utils::pgn_reader::generateMovesForPawnAndDestCaptureTempl ( const ChessBoard board,
ShortMoveList moves,
SquareSet  srcSqMask,
Square  dst 
)
noexcept

◆ generateMovesForPawnAndDestNoCaptureStoreFnTempl()

template<MoveGenType type, typename MoveStoreFn >
void hoover_chess_utils::pgn_reader::generateMovesForPawnAndDestNoCaptureStoreFnTempl ( const ChessBoard board,
SquareSet  srcSqMask,
Square  dst,
typename MoveStoreFn::Store &  store 
)
inlinenoexcept

◆ generateMovesForPawnAndDestNoCaptureTempl()

template<MoveGenType type>
std::size_t hoover_chess_utils::pgn_reader::generateMovesForPawnAndDestNoCaptureTempl ( const ChessBoard board,
ShortMoveList moves,
SquareSet  srcSqMask,
Square  dst 
)
noexcept

◆ generateMovesForPawnAndDestPromoCaptureStoreFnTempl()

template<MoveGenType type, typename MoveStoreFn >
void hoover_chess_utils::pgn_reader::generateMovesForPawnAndDestPromoCaptureStoreFnTempl ( const ChessBoard board,
SquareSet  srcSqMask,
Square  dst,
Piece  promo,
typename MoveStoreFn::Store &  store 
)
inlinenoexcept

◆ generateMovesForPawnAndDestPromoCaptureTempl()

template<MoveGenType type>
std::size_t hoover_chess_utils::pgn_reader::generateMovesForPawnAndDestPromoCaptureTempl ( const ChessBoard board,
ShortMoveList moves,
SquareSet  srcSqMask,
Square  dst,
Piece  promo 
)
noexcept

◆ generateMovesForPawnAndDestPromoNoCaptureStoreFnTempl()

template<MoveGenType type, typename MoveStoreFn >
void hoover_chess_utils::pgn_reader::generateMovesForPawnAndDestPromoNoCaptureStoreFnTempl ( const ChessBoard board,
SquareSet  srcSqMask,
Square  dst,
Piece  promo,
typename MoveStoreFn::Store &  store 
)
inlinenoexcept

◆ generateMovesForPawnAndDestPromoNoCaptureTempl()

template<MoveGenType type>
std::size_t hoover_chess_utils::pgn_reader::generateMovesForPawnAndDestPromoNoCaptureTempl ( const ChessBoard board,
ShortMoveList moves,
SquareSet  srcSqMask,
Square  dst,
Piece  promo 
)
noexcept

◆ generateMovesForPawns()

template<typename IteratorType , MoveGenType type, typename ParamType >
auto hoover_chess_utils::pgn_reader::generateMovesForPawns ( const ChessBoard board,
IteratorType  i,
ParamType  legalDestinations 
) -> IteratorType
noexcept

Generates legal pawn moves, dispatch for side-to-move.

Template Parameters
IteratorTypeMove list iterator type
typeMove generator type
legalDestinationsParameter type for legal destinations
Parameters
[in]boardChess board
[in]iMove list iterator (begin of list)
[in]legalDestinationsLegal destinations
Returns
Move list iterator (end of generated moves)

◆ generateMovesForPawnsTempl()

template<typename IteratorType , MoveGenType type, typename ParamType , Color turn>
auto hoover_chess_utils::pgn_reader::generateMovesForPawnsTempl ( const ChessBoard board,
IteratorType  i,
ParamType  legalDestinations 
) -> IteratorType
noexcept

Generates legal pawn moves, the actual implementation.

Template Parameters
IteratorTypeMove list iterator type
typeMove generator type
legalDestinationsParameter type for legal destinations
turnSide to move
Parameters
[in]boardChess board
[in]iMove list iterator (begin of list)
[in]legalDestinationsLegal destinations
Returns
Move list iterator (end of generated moves)

◆ generateMovesForQueenAndDestTempl()

template<MoveGenType type>
std::size_t hoover_chess_utils::pgn_reader::generateMovesForQueenAndDestTempl ( const ChessBoard board,
ShortMoveList moves,
SquareSet  srcSqMask,
Square  dst 
)
noexcept

◆ generateMovesForRook()

template<typename IteratorType , MoveGenType type, typename ParamType , bool pinned>
auto hoover_chess_utils::pgn_reader::generateMovesForRook ( const ChessBoard board,
IteratorType  i,
Square  sq,
ParamType  legalDestinations,
MoveTypeAndPromotion  typeAndPromo 
) -> IteratorType
noexcept

Generates legal rook moves for queen or rook.

Template Parameters
IteratorTypeMove list iterator type
typeMove generator type
legalDestinationsParameter type for legal destinations
pinnedWhether the piece is pinned
Parameters
[in]boardChess board
[in]iMove list iterator (begin of list)
[in]sqSource square
[in]legalDestinationsLegal destinations
[in]typeAndPromoMoveTypeAndPromotion::REGULAR_ROOK_MOVE or MoveTypeAndPromotion::REGULAR_QUEEN_MOVE depending on the piece.
Returns
Move list iterator (end of generated moves)

◆ generateMovesForRookAndDestTempl()

template<MoveGenType type>
std::size_t hoover_chess_utils::pgn_reader::generateMovesForRookAndDestTempl ( const ChessBoard board,
ShortMoveList moves,
SquareSet  srcSqMask,
Square  dst 
)
noexcept

◆ generateMovesForShortCastlingTempl()

template<MoveGenType type>
std::size_t hoover_chess_utils::pgn_reader::generateMovesForShortCastlingTempl ( const ChessBoard board,
ShortMoveList moves 
)
noexcept

◆ generateMovesForSliderAndDestStoreFnTempl()

template<MoveGenType type, MoveTypeAndPromotion moveType, typename MoveStoreFn >
void hoover_chess_utils::pgn_reader::generateMovesForSliderAndDestStoreFnTempl ( const ChessBoard board,
SquareSet  srcSqMask,
Square  dst,
typename MoveStoreFn::Store &  store 
)
inlinenoexcept

◆ generateMovesIterTempl()

template<MoveGenType type, typename IteratorType >
IteratorType hoover_chess_utils::pgn_reader::generateMovesIterTempl ( const ChessBoard board,
IteratorType  i 
)
inlinenoexcept

Generates all legal moves for a specific iterator type.

Template Parameters
typeMove generator type
IteratorTypeMove list iterator type
Parameters
[in]boardChess board
[in]iMove list iterator (begin of list)
Returns
Move list iterator (end of generated moves)

Depending on the iterator type, we generate the following information

Iterator type Generated return
MoveList::iterator Proper list of legal moves
LegalMoveCounterIterator Number of legal moves
LegalMoveDetectorIterator Whether there are any legal moves

◆ generateMovesTempl()

template<MoveGenType type>
std::size_t hoover_chess_utils::pgn_reader::generateMovesTempl ( const ChessBoard board,
MoveList moves 
)
noexcept

Generates all legal moves for a position.

Template Parameters
typeMove generator type
Parameters
[in]boardChess board
[out]movesMove list
Returns
Number of generated moves

◆ generateSingleMoveForBishopAndDestTempl()

template<MoveGenType type>
Move hoover_chess_utils::pgn_reader::generateSingleMoveForBishopAndDestTempl ( const ChessBoard board,
SquareSet  srcSqMask,
Square  dst 
)
noexcept

◆ generateSingleMoveForKingAndDestTempl()

template<MoveGenType type>
Move hoover_chess_utils::pgn_reader::generateSingleMoveForKingAndDestTempl ( const ChessBoard board,
SquareSet  srcSqMask,
Square  dst 
)
noexcept

◆ generateSingleMoveForKnightAndDestTempl()

template<MoveGenType type>
Move hoover_chess_utils::pgn_reader::generateSingleMoveForKnightAndDestTempl ( const ChessBoard board,
SquareSet  srcSqMask,
Square  dst 
)
noexcept

◆ generateSingleMoveForLongCastlingTempl()

template<MoveGenType type>
Move hoover_chess_utils::pgn_reader::generateSingleMoveForLongCastlingTempl ( const ChessBoard board)
noexcept

◆ generateSingleMoveForPawnAndDestCaptureTempl()

template<MoveGenType type>
Move hoover_chess_utils::pgn_reader::generateSingleMoveForPawnAndDestCaptureTempl ( const ChessBoard board,
SquareSet  srcSqMask,
Square  dst 
)
noexcept

◆ generateSingleMoveForPawnAndDestNoCaptureTempl()

template<MoveGenType type>
Move hoover_chess_utils::pgn_reader::generateSingleMoveForPawnAndDestNoCaptureTempl ( const ChessBoard board,
SquareSet  srcSqMask,
Square  dst 
)
noexcept

◆ generateSingleMoveForPawnAndDestPromoCaptureTempl()

template<MoveGenType type>
Move hoover_chess_utils::pgn_reader::generateSingleMoveForPawnAndDestPromoCaptureTempl ( const ChessBoard board,
SquareSet  srcSqMask,
Square  dst,
Piece  promo 
)
noexcept

◆ generateSingleMoveForPawnAndDestPromoNoCaptureTempl()

template<MoveGenType type>
Move hoover_chess_utils::pgn_reader::generateSingleMoveForPawnAndDestPromoNoCaptureTempl ( const ChessBoard board,
SquareSet  srcSqMask,
Square  dst,
Piece  promo 
)
noexcept

◆ generateSingleMoveForQueenAndDestTempl()

template<MoveGenType type>
Move hoover_chess_utils::pgn_reader::generateSingleMoveForQueenAndDestTempl ( const ChessBoard board,
SquareSet  srcSqMask,
Square  dst 
)
noexcept

◆ generateSingleMoveForRookAndDestTempl()

template<MoveGenType type>
Move hoover_chess_utils::pgn_reader::generateSingleMoveForRookAndDestTempl ( const ChessBoard board,
SquareSet  srcSqMask,
Square  dst 
)
noexcept

◆ generateSingleMoveForShortCastlingTempl()

template<MoveGenType type>
Move hoover_chess_utils::pgn_reader::generateSingleMoveForShortCastlingTempl ( const ChessBoard board)
noexcept

◆ getNumberOfLegalMovesTempl()

template<MoveGenType type>
std::size_t hoover_chess_utils::pgn_reader::getNumberOfLegalMovesTempl ( const ChessBoard board)
noexcept

Returns the number of legal moves for a position.

Template Parameters
typeMove generator type
Parameters
[in]boardChess board
Returns
Number of generated moves

◆ getVersionString()

constexpr std::string_view hoover_chess_utils::pgn_reader::getVersionString ( )
constexprnoexcept

◆ hasLegalMovesTempl()

template<MoveGenType type>
bool hoover_chess_utils::pgn_reader::hasLegalMovesTempl ( const ChessBoard board)
noexcept

Determines whether there are any legal moves.

Template Parameters
typeMove generator type
Parameters
[in]boardChess board
Returns
Whether there are any legal moves

◆ pieceToTypeAndPromotion()

constexpr MoveTypeAndPromotion hoover_chess_utils::pgn_reader::pieceToTypeAndPromotion ( Piece  promotion)
inlineconstexprnoexcept

Variable Documentation

◆ ctBitBoardTables

const BitBoardTables hoover_chess_utils::pgn_reader::ctBitBoardTables
extern

Various bitboard attack and other tables.