Chess Engine
C++ chess engine with movegen, bitboards, and Arduino-friendly docs
|
Go to the source code of this file.
Functions | |
bool | isSquareAttacked (const int square, const int side, const S_BOARD *pos) |
Determines if a given square is attacked by a given side. |
Variables | |
const int | knightDirection [8] = { -8, -19, -21, -12, 8, 19, 21, 12 } |
Knight movement directions in 120-square board representation. | |
const int | rookDirection [4] = { -1, -10, 1, 10 } |
Rook movement directions in 120-square board representation. | |
const int | bishopDirection [4] = { -9, -11, 11, 9 } |
Bishop movement directions in 120-square board representation. | |
const int | kingDirection [8] = { -1, -10, 1, 10, -9, -11, 11, 9 } |
King movement directions in 120-square board representation. |
bool isSquareAttacked | ( | int | sq, |
int | side, | ||
const S_BOARD * | pos ) |
Determines if a given square is attacked by a given side.
sq | Square index (120-based representation). |
side | Side to check for attacks (WHITE or BLACK). |
pos | Pointer to the current board state. |
Definition at line 9 of file attack.cpp.
References ASSERT, bishopDirection, bP, EMPTY, isBoardStateValid(), IsBQ, IsKi, IsKn, IsRQ, kingDirection, knightDirection, OFFBOARD, PceValidEmptyOffbrd(), pieceColor, S_BOARD::pieces, rookDirection, SideValid(), SqIs120(), SqOnBoard(), WHITE, and wP.
Referenced by generateAllMoves(), makeMove(), and makeNullMove().
const int bishopDirection[4] = { -9, -11, 11, 9 } |
Bishop movement directions in 120-square board representation.
Definition at line 6 of file attack.cpp.
Referenced by isSquareAttacked().
const int kingDirection[8] = { -1, -10, 1, 10, -9, -11, 11, 9 } |
King movement directions in 120-square board representation.
Definition at line 7 of file attack.cpp.
Referenced by isSquareAttacked().
const int knightDirection[8] = { -8, -19, -21, -12, 8, 19, 21, 12 } |
Knight movement directions in 120-square board representation.
Definition at line 4 of file attack.cpp.
Referenced by isSquareAttacked().
const int rookDirection[4] = { -1, -10, 1, 10 } |
Rook movement directions in 120-square board representation.
Definition at line 5 of file attack.cpp.
Referenced by isSquareAttacked().