Scid  4.7.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Functions | Variables
movegen Namespace Reference

Functions

bool valid_king (squareT sqFrom, squareT sqTo)
 
bool valid_knight (squareT sqFrom, squareT sqTo)
 
int valid_slider (squareT sqFrom, squareT sqTo, pieceT pieceType)
 
bool attack_pawn (squareT sqFrom, squareT sqTo, colorT pieceCol)
 
template<typename TBoard >
bool attack_slider (squareT sqFrom, squareT sqTo, pieceT pieceType, const TBoard *board, const TBoard EMPTY_SQUARE)
 
template<typename TBoard >
bool attack (squareT sqFrom, squareT sqTo, pieceT pieceCol, pieceT pieceType, const TBoard *board, const TBoard EMPTY_SQUARE)
 Validate an ATTACK move, that is if a piece placed at sqFrom can capture an enemy piece at sqTo. More...
 
template<typename TBoard >
bool pseudo (squareT sqFrom, squareT sqTo, colorT, pieceT pieceType, const TBoard *board, const TBoard EMPTY_SQUARE)
 
template<typename TBoard >
std::pair< pieceT, squareTopens_ray (squareT sqFrom, squareT sqTo, squareT sqRay, const TBoard *board, const TBoard EMPTY_SQUARE)
 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. More...
 

Variables

const int NSQUARES = 8
 

Function Documentation

◆ attack()

template<typename TBoard >
bool movegen::attack ( squareT  sqFrom,
squareT  sqTo,
pieceT  pieceCol,
pieceT  pieceType,
const TBoard *  board,
const TBoard  EMPTY_SQUARE 
)

Validate an ATTACK move, that is if a piece placed at sqFrom can capture an enemy piece at sqTo.

Parameters
sqFromsquare of the piece.
sqTosquare of the piece to be captured.
pieceColcolor of the moving piece.
pieceTypetype of the moving piece.
boardpointer to the board position; it's is irrelevant if the position is the one before or after the move was made.
EMPTY_SQUAREvalue of an empty square in the board position.
Returns
true if the move is a valid ATTACK move.

Definition at line 132 of file movegen.h.

◆ attack_pawn()

bool movegen::attack_pawn ( squareT  sqFrom,
squareT  sqTo,
colorT  pieceCol 
)
inline

Definition at line 89 of file movegen.h.

◆ attack_slider()

template<typename TBoard >
bool movegen::attack_slider ( squareT  sqFrom,
squareT  sqTo,
pieceT  pieceType,
const TBoard *  board,
const TBoard  EMPTY_SQUARE 
)

Definition at line 101 of file movegen.h.

◆ opens_ray()

template<typename TBoard >
std::pair<pieceT, squareT> movegen::opens_ray ( squareT  sqFrom,
squareT  sqTo,
squareT  sqRay,
const TBoard *  board,
const TBoard  EMPTY_SQUARE 
)
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.

Parameters
sqFromstart square of the pseudo-legal move.
sqTodestination square of the pseudo-legal move.
sqRaythe projected ray starts from sqRay and goes through sqFrom; it is usually the square where the king is.
boardpointer to the board position where the pseudo-legal move has to be made.
EMPTY_SQUAREvalue of an empty square in the board position.
Returns
a std::pair with the type (INVALID_PIECE, BISHOP, ROOK) and the square of the candidate pinning piece. If the type is INVALID_PIECE there is no pin and the move is legal, otherwise it's necessary to test the board position and if the returned square is occupied by an enemy QUEEN, or an enemy piece matching the returned type, the move is not legal.

Definition at line 179 of file movegen.h.

◆ pseudo()

template<typename TBoard >
bool movegen::pseudo ( squareT  sqFrom,
squareT  sqTo,
colorT  ,
pieceT  pieceType,
const TBoard *  board,
const TBoard  EMPTY_SQUARE 
)

Definition at line 148 of file movegen.h.

◆ valid_king()

bool movegen::valid_king ( squareT  sqFrom,
squareT  sqTo 
)
inline

Definition at line 46 of file movegen.h.

◆ valid_knight()

bool movegen::valid_knight ( squareT  sqFrom,
squareT  sqTo 
)
inline

Definition at line 52 of file movegen.h.

◆ valid_slider()

int movegen::valid_slider ( squareT  sqFrom,
squareT  sqTo,
pieceT  pieceType 
)
inline

Definition at line 59 of file movegen.h.

Variable Documentation

◆ NSQUARES

const int movegen::NSQUARES = 8

Definition at line 44 of file movegen.h.