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

Go to the source code of this file.

Functions

bool isSquareAttacked (int sq, int side, const S_BOARD *pos)
 Determines if a given square is attacked by a given side.

Variables

const int knightDirection [8]
 Knight movement directions in 120-square board representation.
const int rookDirection [4]
 Rook movement directions in 120-square board representation.
const int bishopDirection [4]
 Bishop movement directions in 120-square board representation.
const int kingDirection [8]
 King movement directions in 120-square board representation.

Function Documentation

◆ isSquareAttacked()

bool isSquareAttacked ( int sq,
int side,
const S_BOARD * pos )
extern

Determines if a given square is attacked by a given side.

Parameters
sqSquare index (120-based representation).
sideSide to check for attacks (WHITE or BLACK).
posPointer to the current board state.
Returns
true if the square is attacked by the given side, false otherwise.

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().

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

Variable Documentation

◆ bishopDirection

const int bishopDirection[4]
extern

Bishop movement directions in 120-square board representation.

Definition at line 6 of file attack.cpp.

Referenced by isSquareAttacked().

◆ kingDirection

const int kingDirection[8]
extern

King movement directions in 120-square board representation.

Definition at line 7 of file attack.cpp.

Referenced by isSquareAttacked().

◆ knightDirection

const int knightDirection[8]
extern

Knight movement directions in 120-square board representation.

Definition at line 4 of file attack.cpp.

Referenced by isSquareAttacked().

◆ rookDirection

const int rookDirection[4]
extern

Rook movement directions in 120-square board representation.

Definition at line 5 of file attack.cpp.

Referenced by isSquareAttacked().