Chess Engine
C++ chess engine with movegen, bitboards, and Arduino-friendly docs
|
Go to the source code of this file.
Functions | |
bool | isPieceListValid (const S_BOARD *pos) |
Validate that piece list array is consistent with board state. | |
bool | isBoardStateValid (const S_BOARD *pos) |
Performs a full internal consistency check of the board state. | |
void | updateListsMaterial (S_BOARD *pos) |
Update piece lists, material counts, and pawn bitboards from scratch. | |
int | loadFEN (char *fen, S_BOARD *pos) |
Parse a FEN string into the given board state. | |
void | resetBoardState (S_BOARD *pos) |
Reset board to empty state. | |
void | printBoardState (const S_BOARD *pos) |
Print the board to stdout in a human-readable format. | |
void | mirrorBoardPosition (S_BOARD *pos) |
Flip the board vertically, swapping colors and positions. |
|
extern |
Performs a full internal consistency check of the board state.
pos | Pointer to board state. |
Definition at line 28 of file board.cpp.
References ASSERT, S_BOARD::bigPce, bK, BLACK, BOTH, bP, S_BOARD::castlePerm, CNT, S_BOARD::enPas, generatePositionKeys(), isBigPiece, isMajorPiece, isMinorPiece, isPieceListValid(), S_BOARD::KingSq, S_BOARD::majPce, S_BOARD::material, S_BOARD::minPce, NO_SQ, S_BOARD::pawns, S_BOARD::pceNum, pieceColor, S_BOARD::pieces, pieceValue, S_BOARD::pList, POP, S_BOARD::posKey, RANK_3, RANK_6, rankIndex120, S_BOARD::side, SQ120, TRUE, WHITE, wK, and wP.
Referenced by AddBlackPawnCapMove(), AddBlackPawnMove(), AddCaptureMove(), AddEnPassantMove(), AddQuietMove(), AddWhitePawnCapMove(), AddWhitePawnMove(), ClearPiece(), generateAllCaptures(), generateAllMoves(), isSquareAttacked(), makeMove(), makeNullMove(), mirrorBoardPosition(), parseMoveString(), Perft(), PerftTest(), takeMove(), and takeNullMove().
|
extern |
Validate that piece list array is consistent with board state.
pos | Pointer to board state. |
Definition at line 12 of file board.cpp.
References bK, FALSE, S_BOARD::pceNum, S_BOARD::pList, SqOnBoard(), wK, and wP.
Referenced by isBoardStateValid().
|
extern |
Parse a FEN string into the given board state.
fen | FEN string. |
pos | Pointer to board state. |
Definition at line 146 of file board.cpp.
References ASSERT, bB, bK, BKCA, BLACK, bN, bP, bQ, BQCA, bR, S_BOARD::castlePerm, EMPTY, S_BOARD::enPas, FILE_A, FILE_H, FR2SQ, generatePositionKeys(), S_BOARD::pieces, S_BOARD::posKey, RANK_1, RANK_8, resetBoardState(), S_BOARD::side, SQ120, updateListsMaterial(), wB, WHITE, wK, WKCA, wN, wP, wQ, WQCA, and wR.
Referenced by main().
|
extern |
Flip the board vertically, swapping colors and positions.
pos | Pointer to board state. |
Definition at line 301 of file board.cpp.
References ASSERT, bB, bK, BKCA, bN, bP, bQ, BQCA, bR, S_BOARD::castlePerm, EMPTY, S_BOARD::enPas, generatePositionKeys(), isBoardStateValid(), Mirror64, NO_SQ, S_BOARD::pieces, S_BOARD::posKey, resetBoardState(), S_BOARD::side, SQ120, SQ64, updateListsMaterial(), wB, wK, WKCA, wN, wP, wQ, WQCA, and wR.
|
extern |
Print the board to stdout in a human-readable format.
pos | Pointer to board state. |
Definition at line 272 of file board.cpp.
References BKCA, BQCA, S_BOARD::castlePerm, S_BOARD::enPas, FILE_A, FILE_H, FR2SQ, S_BOARD::pieces, pieceToCharacter, S_BOARD::posKey, RANK_1, RANK_8, S_BOARD::side, SideChar, WKCA, and WQCA.
Referenced by main(), and PerftTest().
|
extern |
Reset board to empty state.
pos | Pointer to board state. |
Definition at line 236 of file board.cpp.
References S_BOARD::bigPce, BLACK, BOTH, BRD_SQ_NUM, S_BOARD::castlePerm, EMPTY, S_BOARD::enPas, S_BOARD::fiftyMove, S_BOARD::hisPly, S_BOARD::KingSq, S_BOARD::majPce, S_BOARD::material, S_BOARD::minPce, NO_SQ, OFFBOARD, S_BOARD::pawns, S_BOARD::pceNum, S_BOARD::pieces, S_BOARD::ply, S_BOARD::posKey, S_BOARD::side, SQ120, and WHITE.
Referenced by loadFEN(), and mirrorBoardPosition().
|
extern |
Update piece lists, material counts, and pawn bitboards from scratch.
pos | Pointer to board state. |
Definition at line 112 of file board.cpp.
References ASSERT, S_BOARD::bigPce, bK, BLACK, BOTH, bP, BRD_SQ_NUM, EMPTY, isBigPiece, isMajorPiece, isMinorPiece, S_BOARD::KingSq, S_BOARD::majPce, S_BOARD::material, S_BOARD::minPce, OFFBOARD, S_BOARD::pawns, S_BOARD::pceNum, PceValidEmptyOffbrd(), pieceColor, S_BOARD::pieces, pieceValue, S_BOARD::pList, SETBIT, SideValid(), SQ64, TRUE, WHITE, wK, and wP.
Referenced by loadFEN(), and mirrorBoardPosition().