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

Go to the source code of this file.

Functions

int makeMove (S_BOARD *pos, int move)
 Make a move; returns non-zero if legal (king not left in check).
void takeMove (S_BOARD *pos)
 Undo the last made move.
void makeNullMove (S_BOARD *pos)
 Make a null move (side to move toggles, no pieces moved).
void takeNullMove (S_BOARD *pos)
 Undo the last null move.

Variables

const int CastlePerm [120]
 Castling permission mask by board square (mailbox 120).

Function Documentation

◆ makeMove()

int makeMove ( S_BOARD * pos,
int move )
extern

Make a move; returns non-zero if legal (king not left in check).

Definition at line 142 of file make_move.cpp.

References A1, A8, AddPiece(), ASSERT, C1, C8, CAPTURED, CastlePerm, S_BOARD::castlePerm, S_UNDO::castlePerm, ClearPiece(), D1, D8, EMPTY, S_BOARD::enPas, S_UNDO::enPas, F1, F8, FALSE, S_BOARD::fiftyMove, S_UNDO::fiftyMove, FROMSQ, G1, G8, H1, H8, HASH_CA, HASH_EP, HASH_SIDE, S_BOARD::hisPly, S_BOARD::history, isBoardStateValid(), isKing, isPawn, isSquareAttacked(), S_BOARD::KingSq, MAXDEPTH, MAXGAMEMOVES, MFLAGCA, MFLAGEP, MFLAGPS, S_UNDO::move, MovePiece(), NO_SQ, S_BOARD::pieces, pieceValueid(), S_BOARD::ply, S_BOARD::posKey, S_UNDO::posKey, PROMOTED, RANK_3, RANK_6, rankIndex120, S_BOARD::side, SideValid(), SqOnBoard(), takeMove(), TOSQ, TRUE, and WHITE.

Referenced by LegalMovesFrom(), moveExists(), Perft(), and PerftTest().

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

◆ makeNullMove()

void makeNullMove ( S_BOARD * pos)
extern

Make a null move (side to move toggles, no pieces moved).

Definition at line 303 of file make_move.cpp.

References ASSERT, S_BOARD::castlePerm, S_UNDO::castlePerm, S_BOARD::enPas, S_UNDO::enPas, S_BOARD::fiftyMove, S_UNDO::fiftyMove, HASH_EP, HASH_SIDE, S_BOARD::hisPly, S_BOARD::history, isBoardStateValid(), isSquareAttacked(), S_BOARD::KingSq, MAXDEPTH, MAXGAMEMOVES, S_UNDO::move, NO_SQ, NOMOVE, S_BOARD::ply, S_BOARD::posKey, S_UNDO::posKey, and S_BOARD::side.

Here is the call graph for this function:

◆ takeMove()

void takeMove ( S_BOARD * pos)
extern

Undo the last made move.

Definition at line 240 of file make_move.cpp.

References A1, A8, AddPiece(), ASSERT, bP, C1, C8, CAPTURED, S_BOARD::castlePerm, S_UNDO::castlePerm, ClearPiece(), D1, D8, EMPTY, S_BOARD::enPas, S_UNDO::enPas, F1, F8, FALSE, S_BOARD::fiftyMove, S_UNDO::fiftyMove, FROMSQ, G1, G8, H1, H8, HASH_CA, HASH_EP, HASH_SIDE, S_BOARD::hisPly, S_BOARD::history, isBoardStateValid(), isKing, isPawn, S_BOARD::KingSq, MAXDEPTH, MAXGAMEMOVES, MFLAGCA, MFLAGEP, S_UNDO::move, MovePiece(), NO_SQ, pieceColor, S_BOARD::pieces, pieceValueid(), S_BOARD::ply, PROMOTED, S_BOARD::side, SqOnBoard(), TOSQ, WHITE, and wP.

Referenced by LegalMovesFrom(), makeMove(), moveExists(), Perft(), and PerftTest().

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

◆ takeNullMove()

void takeNullMove ( S_BOARD * pos)
extern

Undo the last null move.

Definition at line 327 of file make_move.cpp.

References ASSERT, S_BOARD::castlePerm, S_UNDO::castlePerm, S_BOARD::enPas, S_UNDO::enPas, S_BOARD::fiftyMove, S_UNDO::fiftyMove, HASH_EP, HASH_SIDE, S_BOARD::hisPly, S_BOARD::history, isBoardStateValid(), MAXDEPTH, MAXGAMEMOVES, NO_SQ, S_BOARD::ply, and S_BOARD::side.

Here is the call graph for this function:

Variable Documentation

◆ CastlePerm

const int CastlePerm[120]
extern

Castling permission mask by board square (mailbox 120).

Definition at line 14 of file make_move.cpp.

Referenced by makeMove().