|
libscid 0.1.0
Chess applications made easy.
|
Move validation predicates. More...
Include dependency graph for move_predicates.h:Go to the source code of this file.
Functions | |
| bool | scid::core::move_predicates::valid_king (squareT sqFrom, squareT sqTo) |
| bool | scid::core::move_predicates::valid_knight (squareT sqFrom, squareT sqTo) |
| int | scid::core::move_predicates::valid_slider (squareT sqFrom, squareT sqTo, pieceT pieceType) |
| bool | scid::core::move_predicates::attack_pawn (squareT sqFrom, squareT sqTo, colorT pieceCol) |
| template<typename TFunc > | |
| bool | scid::core::move_predicates::attack_slider (squareT sqFrom, squareT sqTo, pieceT pieceType, TFunc isOccupied) |
| template<typename TFunc > | |
| bool | scid::core::move_predicates::attack (squareT sqFrom, squareT sqTo, pieceT pieceCol, pieceT pieceType, TFunc isOccupied) |
| Validate an ATTACK move, that is if a piece placed at sqFrom can capture an enemy piece at sqTo. | |
| template<typename TFunc > | |
| bool | scid::core::move_predicates::pseudo_advance_pawn (squareT sqFrom, squareT sqTo, colorT pieceCol, TFunc isOccupied) |
| template<typename TFunc > | |
| bool | scid::core::move_predicates::pseudo (squareT sqFrom, squareT sqTo, colorT pieceCol, pieceT pieceType, TFunc isOccupied) |
| template<typename TFunc > | |
| std::pair< pieceT, squareT > | scid::core::move_predicates::opens_ray (squareT sqFrom, squareT sqTo, squareT sqRay, TFunc isOccupied) |
| Given a pseudo-legal move, this functions return the type and the location of the piece that can possibly pin the moving piece, making the move not legal. | |
| bool | scid::core::move_predicates::blocks_ray (squareT sqFrom, squareT sqTo, squareT sqBlock) |
| Checks if there is a valid ray from sqFrom to sqTo and if a piece on sqBlock would block that ray. | |
Variables | |
| constexpr int | scid::core::move_predicates::NSQUARES = 8 |
| constexpr int | scid::core::move_predicates::kWPHomeRank = 1 |
| constexpr int | scid::core::move_predicates::kBPHomeRank = NSQUARES - 2 |
Move validation predicates.
| bool scid::core::move_predicates::attack | ( | squareT | sqFrom, |
| squareT | sqTo, | ||
| pieceT | pieceCol, | ||
| pieceT | pieceType, | ||
| TFunc | isOccupied | ||
| ) |
Validate an ATTACK move, that is if a piece placed at sqFrom can capture an enemy piece at sqTo.
| sqFrom | square of the piece. |
| sqTo | square of the piece to be captured. |
| pieceCol | color of the moving piece. |
| pieceType | type of the moving piece. |
| isOccupied | callable object which should returns true if a square is occupied by a piece. Since it is not invoked with sqFrom or sqTo, it's is irrelevant if the position is the one before or after the move was made. |
|
inline |
Checks if there is a valid ray from sqFrom to sqTo and if a piece on sqBlock would block that ray.
| sqFrom | start square of the ray. |
| sqTo | end square of the ray. |
| sqBlock | the square that may block the ray. |
|
inline |
Given a pseudo-legal move, this functions return the type and the location of the piece that can possibly pin the moving piece, making the move not legal.
| sqFrom | start square of the pseudo-legal move. |
| sqTo | destination square of the pseudo-legal move. |
| sqRay | the projected ray starts from sqRay and goes through sqFrom; it is usually the square where the king is. |
| isOccupied | callable object which should returns true if a square is occupied by a piece. |