13 { 0, 0, 0, 0, 0, 0, 0 },
14 { 0, 0, 0, 0, 0, 0, 0 },
15 { -8, -19, -21, -12, 8, 19, 21, 12 },
16 { -9, -11, 11, 9, 0, 0, 0, 0 },
17 { -1, -10, 1, 10, 0, 0, 0, 0 },
18 { -1, -10, 1, 10, -9, -11, 11, 9 },
19 { -1, -10, 1, 10, -9, -11, 11, 9 },
20 { 0, 0, 0, 0, 0, 0, 0 },
21 { -8, -19, -21, -12, 8, 19, 21, 12 },
22 { -9, -11, 11, 9, 0, 0, 0, 0 },
23 { -1, -10, 1, 10, 0, 0, 0, 0 },
24 { -1, -10, 1, 10, -9, -11, 11, 9 },
25 { -1, -10, 1, 10, -9, -11, 11, 9 }
28const int numberDirections[13] = { 0, 0, 8, 4, 4, 8, 8, 0, 8, 4, 4, 8, 8 };
30const int VictimScore[13] = { 0,100,200,300,400,500,600,100,200,300,400,500,600 };
74 slot.score = 105 + 1000000;
142 for (
int attacker =
wP; attacker <=
bK; ++attacker) {
143 for (
int victim =
wP; victim <=
bK; ++victim) {
153 for (
int i = 0; i < moveList->
count; ++i) {
169 const int side = board->
side;
172 for (
int pi = 0; pi < board->
pceNum[
wP]; ++pi) {
173 const int fromSq = board->
pList[
wP][pi];
210 for (
int pi = 0; pi < board->
pceNum[
bP]; ++pi) {
211 const int fromSq = board->
pList[
bP][pi];
252 for (
int pi = 0; pi < board->
pceNum[piece]; ++pi) {
253 const int fromSq = board->
pList[piece][pi];
258 int targetSq = fromSq + delta;
277 for (
int pi = 0; pi < board->
pceNum[piece]; ++pi) {
278 const int fromSq = board->
pList[piece][pi];
303 const int side = board->
side;
306 for (
int pi = 0; pi < board->
pceNum[
wP]; ++pi) {
307 const int fromSq = board->
pList[
wP][pi];
321 for (
int pi = 0; pi < board->
pceNum[
bP]; ++pi) {
322 const int fromSq = board->
pList[
bP][pi];
340 for (
int pi = 0; pi < board->
pceNum[piece]; ++pi) {
341 const int fromSq = board->
pList[piece][pi];
346 int targetSq = fromSq + delta;
364 for (
int pi = 0; pi < board->
pceNum[piece]; ++pi) {
365 const int fromSq = board->
pList[piece][pi];
bool isSquareAttacked(const int square, const int side, const S_BOARD *pos)
Determines if a given square is attacked by a given side.
bool isBoardStateValid(const S_BOARD *pos)
Performs a full internal consistency check of the board state.
int pieceColor[13]
Color of each piece type.
int makeMove(S_BOARD *board, int move)
Make a move; returns non-zero if legal (king not left in check).
void takeMove(S_BOARD *board)
Undo the last made move.
const int VictimScore[13]
Victim scoring table for MVV-LVA.
static void AddEnPassantMove(const S_BOARD *board, int move, S_MOVELIST *moveList)
static void AddBlackPawnCapMove(const S_BOARD *board, int fromSq, int toSq, int captured, S_MOVELIST *moveList)
void InitMvvLva()
Initialize the MVV-LVA capture scoring table.
static void AddQuietMove(const S_BOARD *board, int move, S_MOVELIST *moveList)
void generateAllMoves(const S_BOARD *board, S_MOVELIST *moveList)
Generate all pseudo-legal moves for the side to move.
int moveExists(S_BOARD *board, const int move)
Check if a given move exists in the current position.
const int pieceDirection[13][8]
Direction offsets for each piece type.
static void AddBlackPawnMove(const S_BOARD *board, int fromSq, int toSq, S_MOVELIST *moveList)
static void AddWhitePawnMove(const S_BOARD *board, int fromSq, int toSq, S_MOVELIST *moveList)
static int MvvLvaScores[13][13]
const int LoopNonSlideIndex[2]
Indices into LoopNonSlidePce for white and black.
const int LoopNonSlidePce[6]
Non-sliding piece loop order for move generation.
static void AddWhitePawnCapMove(const S_BOARD *board, int fromSq, int toSq, int captured, S_MOVELIST *moveList)
const int numberDirections[13]
Number of valid directions for each piece type.
const int LoopSlidePce[8]
Sliding piece loop order for move generation.
static void AddCaptureMove(const S_BOARD *board, int move, S_MOVELIST *moveList)
void generateAllCaptures(const S_BOARD *board, S_MOVELIST *moveList)
Generate all pseudo-legal capture moves (including en passant).
const int LoopSlideIndex[2]
Indices into LoopSlidePce for white and black.
#define SQOFFBOARD(sq)
Macro to check if a square index is off the board.
#define MOVE(f, t, ca, pro, fl)
Macro to encode a move into an integer.
int rankIndex120[BRD_SQ_NUM]
int searchKillers[2][MAXDEPTH]
int searchHistory[13][BRD_SQ_NUM]
S_MOVE moves[MAXPOSITIONMOVES]
int MoveListOk(const S_MOVELIST *moves, const S_BOARD *board)
Validates that a move list is within bounds and references valid moves.
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 SqOnBoard(const int sq)
Checks if a given square index refers to a valid on-board square.