Chess Engine
C++ chess engine with movegen, bitboards, and Arduino-friendly docs
|
#include "../defs.h"
Go to the source code of this file.
Macros | |
#define | MOVE(f, t, ca, pro, fl) |
Macro to encode a move into an integer. | |
#define | SQOFFBOARD(sq) |
Macro to check if a square index is off the board. |
Functions | |
void | InitMvvLva (void) |
Initialize the MVV-LVA capture scoring table. | |
void | generateAllMoves (const S_BOARD *pos, S_MOVELIST *list) |
Generate all pseudo-legal moves for the side to move. | |
void | generateAllCaptures (const S_BOARD *pos, S_MOVELIST *list) |
Generate all pseudo-legal capture moves (including en passant). | |
int | moveExists (S_BOARD *pos, int move) |
Check if a given move exists in the current position. |
Variables | |
const int | LoopSlidePce [8] |
Sliding piece loop order for move generation. | |
const int | LoopNonSlidePce [6] |
Non-sliding piece loop order for move generation. | |
const int | LoopSlideIndex [2] |
Indices into LoopSlidePce for white and black. | |
const int | LoopNonSlideIndex [2] |
Indices into LoopNonSlidePce for white and black. | |
const int | pieceDirection [13][8] |
Direction offsets for each piece type. | |
const int | numberDirections [13] |
Number of valid directions for each piece type. | |
const int | VictimScore [13] |
Victim scoring table for MVV-LVA. | |
int | MvvLvaScores [13][13] |
Most Valuable Victim / Least Valuable Attacker scores. |
#define MOVE | ( | f, | |
t, | |||
ca, | |||
pro, | |||
fl ) |
Macro to encode a move into an integer.
Definition at line 7 of file move_generator.h.
Referenced by AddBlackPawnCapMove(), AddBlackPawnMove(), AddWhitePawnCapMove(), AddWhitePawnMove(), generateAllCaptures(), and generateAllMoves().
#define SQOFFBOARD | ( | sq | ) |
Macro to check if a square index is off the board.
Definition at line 10 of file move_generator.h.
Referenced by generateAllCaptures(), and generateAllMoves().
|
extern |
Generate all pseudo-legal capture moves (including en passant).
pos | Pointer to the current board position. |
list | Pointer to the move list to be filled. |
Definition at line 299 of file move_generator.cpp.
References AddBlackPawnCapMove(), AddCaptureMove(), AddEnPassantMove(), AddWhitePawnCapMove(), ASSERT, BLACK, bP, S_MOVELIST::count, EMPTY, S_BOARD::enPas, isBoardStateValid(), LoopNonSlideIndex, LoopNonSlidePce, LoopSlideIndex, LoopSlidePce, MFLAGEP, MOVE, MoveListOk(), NO_SQ, numberDirections, S_BOARD::pceNum, pieceColor, pieceDirection, S_BOARD::pieces, pieceValueid(), S_BOARD::pList, S_BOARD::side, SQOFFBOARD, SqOnBoard(), WHITE, and wP.
|
extern |
Generate all pseudo-legal moves for the side to move.
pos | Pointer to the current board position. |
list | Pointer to the move list to be filled. |
Definition at line 165 of file move_generator.cpp.
References AddBlackPawnCapMove(), AddBlackPawnMove(), AddCaptureMove(), AddEnPassantMove(), AddQuietMove(), AddWhitePawnCapMove(), AddWhitePawnMove(), ASSERT, B1, B8, BKCA, BLACK, bP, BQCA, C1, C8, S_BOARD::castlePerm, S_MOVELIST::count, D1, D8, E1, E8, EMPTY, S_BOARD::enPas, F1, F8, G1, G8, isBoardStateValid(), isSquareAttacked(), LoopNonSlideIndex, LoopNonSlidePce, LoopSlideIndex, LoopSlidePce, MFLAGCA, MFLAGEP, MFLAGPS, MOVE, MoveListOk(), NO_SQ, numberDirections, S_BOARD::pceNum, pieceColor, pieceDirection, S_BOARD::pieces, pieceValueid(), S_BOARD::pList, RANK_2, RANK_7, rankIndex120, S_BOARD::side, SQOFFBOARD, SqOnBoard(), WHITE, WKCA, wP, and WQCA.
Referenced by LegalMovesFrom(), moveExists(), parseMoveString(), Perft(), and PerftTest().
|
extern |
Initialize the MVV-LVA capture scoring table.
Definition at line 141 of file move_generator.cpp.
References bK, MvvLvaScores, VictimScore, and wP.
Referenced by initializeEngine().
|
extern |
Check if a given move exists in the current position.
pos | Pointer to the current board position. |
move | Encoded move integer. |
Definition at line 149 of file move_generator.cpp.
References S_MOVELIST::count, FALSE, generateAllMoves(), makeMove(), S_MOVE::move, S_MOVELIST::moves, takeMove(), and TRUE.
|
extern |
Indices into LoopNonSlidePce for white and black.
Definition at line 10 of file move_generator.cpp.
Referenced by generateAllCaptures(), and generateAllMoves().
|
extern |
Non-sliding piece loop order for move generation.
Definition at line 8 of file move_generator.cpp.
Referenced by generateAllCaptures(), and generateAllMoves().
|
extern |
Indices into LoopSlidePce for white and black.
Definition at line 9 of file move_generator.cpp.
Referenced by generateAllCaptures(), and generateAllMoves().
|
extern |
Sliding piece loop order for move generation.
Definition at line 7 of file move_generator.cpp.
Referenced by generateAllCaptures(), and generateAllMoves().
|
extern |
Most Valuable Victim / Least Valuable Attacker scores.
|
extern |
Number of valid directions for each piece type.
Definition at line 28 of file move_generator.cpp.
Referenced by generateAllCaptures(), and generateAllMoves().
|
extern |
Direction offsets for each piece type.
Definition at line 12 of file move_generator.cpp.
Referenced by generateAllCaptures(), and generateAllMoves().
|
extern |
Victim scoring table for MVV-LVA.
Definition at line 30 of file move_generator.cpp.
Referenced by InitMvvLva().