HooverChessUtils_PgnReader 0.9.0
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
hoover_chess_utils::pgn_reader::Intercepts Class Reference

Check interceptions and pin checks. More...

#include <bitboard-intercepts.h>

Static Public Member Functions

static SquareSet getInterceptSquares (Square kingSq, Square checkerSq) noexcept
 Returns the set of squares that intercepts a check.
 
static SquareSet getRay (Square kingSq, Square pinnedSq) noexcept
 Returns a ray from king square to the direction of pinned piece square.
 
template<bool pinned>
static SquareSet getPinRestiction (Square kingSq, Square pinnedSq) noexcept
 

Detailed Description

Check interceptions and pin checks.

Member Function Documentation

◆ getInterceptSquares()

static SquareSet hoover_chess_utils::pgn_reader::Intercepts::getInterceptSquares ( Square  kingSq,
Square  checkerSq 
)
inlinestaticnoexcept

Returns the set of squares that intercepts a check.

Parameters
[in]kingSqKing square
[in]checkerSqChecker square. May be Square::NONE.
Returns
The set of intercept squares or SquareSet::all() when the checker is Square::NONE.

The set of squares that intercept a check are:

  • checkerSq (assume captured)
  • If checkerSq is along a ray direction from kingSq, then all squares in between (but not including kingSq)

Illustration

K
C

Where:

  • K = the checked king
  • C = the checker
  • shaded = the intercept squares

◆ getPinRestiction()

template<bool pinned>
static SquareSet hoover_chess_utils::pgn_reader::Intercepts::getPinRestiction ( Square  kingSq,
Square  pinnedSq 
)
inlinestaticnoexcept

◆ getRay()

static SquareSet hoover_chess_utils::pgn_reader::Intercepts::getRay ( Square  kingSq,
Square  pinnedSq 
)
inlinestaticnoexcept

Returns a ray from king square to the direction of pinned piece square.

Parameters
[in]kingSqKing square
[in]pinnedSqSquare of the pinned piece
Precondition
(Asserted) kingSqpinnedSq must be on the same rank, file, diagonal, or anti-diagonal.

The ray represents the squares that are valid for a pinned piece, as pinned piece can only be moved along the pin axis.


The documentation for this class was generated from the following file: