|
HooverChessUtils_PgnReader 0.9.0
|
A legal move. Important: see the note! More...
#include <chessboard.h>
Public Member Functions | |
| constexpr | Move () noexcept=default |
| Default constructor (null move) | |
| constexpr | Move (Square src, Square dst, MoveTypeAndPromotion typeAndPromo) noexcept |
| Constructor. | |
| constexpr | Move (const Move &) noexcept=default |
| Constructor (copy) | |
| constexpr | Move (Move &&) noexcept=default |
| Constructor (move) | |
| Move & | operator= (const Move &) noexcept=default |
| Assignment. | |
| Move & | operator= (Move &&) noexcept=default |
| Move assignment. | |
| constexpr | Move (const CompactMove &m) noexcept |
Constructs a Move from a CompactMove | |
| ~Move () noexcept=default | |
| Destructor. | |
| constexpr Square | getSrc () const noexcept |
| Returns move source square. | |
| constexpr Square | getDst () const noexcept |
| Returns move destination square. | |
| constexpr MoveTypeAndPromotion | getTypeAndPromotion () const noexcept |
| Returns move type and promotion piece. | |
| constexpr bool | isRegularMove () const noexcept |
| Checks whether a move type is regular. | |
| constexpr bool | isEnPassantMove () const noexcept |
| Checks whether the move type is en-passant pawn capture. | |
| constexpr bool | isPromotionMove () const noexcept |
| Checks whether the move type is a pawn promotion. | |
| constexpr bool | isCastlingMove () const noexcept |
| Checks whether a move type is a castling move. | |
| constexpr Piece | getPromotionPiece () const noexcept |
| Returns promotion piece of a promotion move. | |
| constexpr bool | isIllegal () const noexcept |
| Checks whether the move type is illegal. | |
| constexpr std::uint_fast16_t | getEncodedValue () const noexcept |
| Returns raw encoded value. Usually only used in debugging. | |
| constexpr bool | operator== (const Move &o) const noexcept |
| Comparator (equality) | |
Static Public Member Functions | |
| static constexpr Move | illegalNoMove () noexcept |
| Token for illegal move: no moves generated. | |
| static constexpr Move | illegalAmbiguousMove () noexcept |
| Token for illegal move: ambiguous move generation. | |
Static Private Member Functions | |
| static constexpr std::uint_fast16_t | getMoveTypeAndPromotionMask (MoveTypeAndPromotionUnderlyingType mask) noexcept |
Private Attributes | |
| std::uint_fast16_t | m_encoded { } |
| Encoded move. | |
A legal move. Important: see the note!
The move object is intended to be passed to functions as a fast type. The underlying representation is std::uint_fast16_t, which may be larger than 16 bits depending on the target.
When storing moves to memory (e.g., move lists), consider using CompactMove, instead.
ChessBoard::doMove() assumes that the move is legal and it does not perform any legality checks of its own.
|
constexprdefaultnoexcept |
Default constructor (null move)
|
inlineconstexprnoexcept |
Constructor.
| [in] | src | Move source square. Must be a valid square. |
| [in] | dst | Move destination square. Must be a valid square. |
| [in] | typeAndPromo | Move type and promotion piece |
See MoveTypeAndPromotion on how src and dst are used for en-passant and castling move types.
MoveTypeAndPromotion::ILLEGAL on constraints for illegal moves.
|
constexprdefaultnoexcept |
Constructor (copy)
|
constexprdefaultnoexcept |
Constructor (move)
|
inlineconstexprnoexcept |
Constructs a Move from a CompactMove
| [in] | m | Compact move |
|
defaultnoexcept |
Destructor.
|
inlineconstexprnoexcept |
Returns move destination square.
See MoveTypeAndPromotion on how src and dst are used for en-passant and castling move types.
|
inlineconstexprnoexcept |
Returns raw encoded value. Usually only used in debugging.
|
inlinestaticconstexprprivatenoexcept |
|
inlineconstexprnoexcept |
Returns promotion piece of a promotion move.
|
inlineconstexprnoexcept |
Returns move source square.
See MoveTypeAndPromotion on how src and dst are used for en-passant and castling move types.
|
inlineconstexprnoexcept |
Returns move type and promotion piece.
|
inlinestaticconstexprnoexcept |
Token for illegal move: ambiguous move generation.
|
inlinestaticconstexprnoexcept |
Token for illegal move: no moves generated.
|
inlineconstexprnoexcept |
Checks whether a move type is a castling move.
Pawn promotion move types are the following:
|
inlineconstexprnoexcept |
Checks whether the move type is en-passant pawn capture.
En-passant pawn capture move type is the following;
|
inlineconstexprnoexcept |
Checks whether the move type is illegal.
MoveTypeAndPromotion::ILLEGAL on constraints for illegal moves.
|
inlineconstexprnoexcept |
Checks whether the move type is a pawn promotion.
Pawn promotion move types are the following:
|
inlineconstexprnoexcept |
Checks whether a move type is regular.
Regular move types are the following:
|
inlineconstexprnoexcept |
Comparator (equality)
| [in] | o | Another move |
|
private |
Encoded move.
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Destination square | Move type and promotion | Source square | |||||||||||||