Chess Engine
C++ chess engine with movegen, bitboards, and Arduino-friendly docs
Loading...
Searching...
No Matches
validate.h File Reference
#include "../defs.h"
Include dependency graph for validate.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int SqOnBoard (const int sq)
 Checks if a given square index refers to a valid on-board square.
int SideValid (const int side)
 Checks if the given side identifier is valid.
int FileRankValid (const int fr)
 Checks if a file or rank index is valid (0–7).
int pieceValueidEmpty (const int pce)
 Checks if the given piece code is either empty or a valid piece.
int pieceValueid (const int pce)
 Checks if the given piece code is a valid piece (non-empty).
int SqIs120 (const int sq)
 Checks if a given square index is within the 120-based range.
int PceValidEmptyOffbrd (const int pce)
 Checks if the given piece code is empty, valid, or OFFBOARD.
int MoveListOk (const S_MOVELIST *list, const S_BOARD *pos)
 Validates that a move list is within bounds and references valid moves.
void MirrorEvalTest (S_BOARD *pos)
 Mirrors the board position and evaluates it (used for testing).
void DebugAnalysisTest (S_BOARD *pos, S_SEARCHINFO *info)
 Runs a debug analysis test (used for search engine testing).

Function Documentation

◆ DebugAnalysisTest()

void DebugAnalysisTest ( S_BOARD * pos,
S_SEARCHINFO * info )
extern

Runs a debug analysis test (used for search engine testing).

Parameters
posPointer to the board state.
infoPointer to search information.

◆ FileRankValid()

int FileRankValid ( const int fr)
extern

Checks if a file or rank index is valid (0–7).

Parameters
frThe file or rank index.
Returns
Non-zero if valid, 0 otherwise.

Definition at line 38 of file validate.cpp.

◆ MirrorEvalTest()

void MirrorEvalTest ( S_BOARD * pos)
extern

Mirrors the board position and evaluates it (used for testing).

Parameters
posPointer to the board state.

◆ MoveListOk()

int MoveListOk ( const S_MOVELIST * list,
const S_BOARD * pos )
extern

Validates that a move list is within bounds and references valid moves.

Parameters
listPointer to the move list.
posPointer to the board state.
Returns
Non-zero if the move list is valid, 0 otherwise.

Definition at line 7 of file validate.cpp.

References S_MOVELIST::count, FALSE, FROMSQ, MAXPOSITIONMOVES, S_MOVE::move, S_MOVELIST::moves, S_BOARD::pieces, pieceValueidEmpty(), SqOnBoard(), TOSQ, and TRUE.

Referenced by generateAllCaptures(), and generateAllMoves().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PceValidEmptyOffbrd()

int PceValidEmptyOffbrd ( const int pce)
extern

Checks if the given piece code is empty, valid, or OFFBOARD.

Parameters
pcePiece code to check.
Returns
Non-zero if valid, 0 otherwise.

Definition at line 25 of file validate.cpp.

References bK, EMPTY, and OFFBOARD.

Referenced by isSquareAttacked(), and updateListsMaterial().

Here is the caller graph for this function:

◆ pieceValueid()

int pieceValueid ( const int pce)
extern

Checks if the given piece code is a valid piece (non-empty).

Parameters
pcePiece code to check.
Returns
Non-zero if valid, 0 otherwise.

Definition at line 46 of file validate.cpp.

References bK, and wP.

Referenced by AddCaptureMove(), AddPiece(), ClearPiece(), generateAllCaptures(), generateAllMoves(), makeMove(), MovePiece(), and takeMove().

Here is the caller graph for this function:

◆ pieceValueidEmpty()

int pieceValueidEmpty ( const int pce)
extern

Checks if the given piece code is either empty or a valid piece.

Parameters
pcePiece code to check.
Returns
Non-zero if valid, 0 otherwise.

Definition at line 42 of file validate.cpp.

References bK, and EMPTY.

Referenced by AddBlackPawnCapMove(), AddWhitePawnCapMove(), and MoveListOk().

Here is the caller graph for this function:

◆ SideValid()

int SideValid ( const int side)
extern

Checks if the given side identifier is valid.

Parameters
sideSide value to check (WHITE or BLACK).
Returns
Non-zero if valid, 0 otherwise.

Definition at line 34 of file validate.cpp.

References BLACK, and WHITE.

Referenced by AddPiece(), ClearPiece(), isSquareAttacked(), makeMove(), MovePiece(), and updateListsMaterial().

Here is the caller graph for this function:

◆ SqIs120()

int SqIs120 ( const int sq)
extern

Checks if a given square index is within the 120-based range.

Parameters
sqThe square index to check.
Returns
Non-zero if valid, 0 otherwise.

Definition at line 21 of file validate.cpp.

References BRD_SQ_NUM.

Referenced by isSquareAttacked().

Here is the caller graph for this function:

◆ SqOnBoard()

int SqOnBoard ( const int sq)
extern

Checks if a given square index refers to a valid on-board square.

Parameters
sqThe 120-based square index.
Returns
Non-zero if valid, 0 otherwise.

Definition at line 29 of file validate.cpp.

References BRD_SQ_NUM, fileIndex120, and OFFBOARD.

Referenced by AddBlackPawnCapMove(), AddBlackPawnMove(), AddCaptureMove(), AddEnPassantMove(), AddPiece(), AddQuietMove(), AddWhitePawnCapMove(), AddWhitePawnMove(), ClearPiece(), generateAllCaptures(), generateAllMoves(), generatePositionKeys(), initSquareIndexMaps(), isPieceListValid(), isSquareAttacked(), makeMove(), MoveListOk(), MovePiece(), parseMoveString(), and takeMove().

Here is the caller graph for this function: