Chess Engine
C++ chess engine with movegen, bitboards, and Arduino-friendly docs
Loading...
Searching...
No Matches
board_data.cpp File Reference
#include "board_data.h"
Include dependency graph for board_data.cpp:

Go to the source code of this file.

Variables

char pieceToCharacter [] = ".PNBRQKpnbrqk"
 Maps piece, side-to-move, rank and file to their character symbol.
char SideChar [] = "wb-"
char rankToCharacter [] = "12345678"
char fileToCharacter [] = "abcdefgh"
bool isBigPiece [13] = { FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE }
 Lookup tables for piece attributes.
bool isMajorPiece [13] = { FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE }
bool isMinorPiece [13] = { FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE }
int pieceValue [13] = { 0, 100, 325, 325, 550, 1000, 50000, 100, 325, 325, 550, 1000, 50000 }
 Material value of each piece type.
int pieceColor [13]
 Color of each piece type.
bool isPawn [13] = { FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE }
bool isKnight [13] = { FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE }
bool isKing [13] = { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE }
bool isRookQueen [13] = { FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE }
bool isBishopQueen [13] = { FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE }
bool isSlingPiece [13] = { FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE }
int Mirror64 [64]
 Square mirroring lookup from white's perspective.

Variable Documentation

◆ fileToCharacter

char fileToCharacter[] = "abcdefgh"

Definition at line 6 of file board_data.cpp.

◆ isBigPiece

bool isBigPiece[13] = { FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE }

Lookup tables for piece attributes.

Each array index corresponds to a piece constant (EMPTY, wP, wN, ..., bK). Boolean arrays return true if the piece matches the property:

  • isBigPiece: true if piece is not a pawn
  • isMajorPiece: true if rook or queen
  • isMinorPiece: true if bishop or knight
  • isPawn: true if pawn
  • isKnight: true if knight
  • isKing: true if king
  • isRookOrQueen: true if rook or queen
  • isBishopOrQueen: true if bishop or queen
  • isSlidingPiece: true if bishop, rook, or queen

Definition at line 8 of file board_data.cpp.

Referenced by AddPiece(), ClearPiece(), isBoardStateValid(), MovePiece(), and updateListsMaterial().

◆ isBishopQueen

bool isBishopQueen[13] = { FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE }

Definition at line 20 of file board_data.cpp.

◆ isKing

bool isKing[13] = { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE }

Definition at line 18 of file board_data.cpp.

Referenced by makeMove(), and takeMove().

◆ isKnight

bool isKnight[13] = { FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE }

Definition at line 17 of file board_data.cpp.

◆ isMajorPiece

bool isMajorPiece[13] = { FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE }

Definition at line 9 of file board_data.cpp.

Referenced by AddPiece(), ClearPiece(), isBoardStateValid(), and updateListsMaterial().

◆ isMinorPiece

bool isMinorPiece[13] = { FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE }

Definition at line 10 of file board_data.cpp.

Referenced by isBoardStateValid(), and updateListsMaterial().

◆ isPawn

bool isPawn[13] = { FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE }

Definition at line 16 of file board_data.cpp.

Referenced by makeMove(), and takeMove().

◆ isRookQueen

bool isRookQueen[13] = { FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE }

Definition at line 19 of file board_data.cpp.

◆ isSlingPiece

bool isSlingPiece[13] = { FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE }

Definition at line 21 of file board_data.cpp.

◆ Mirror64

int Mirror64[64]
Initial value:
= {
56 , 57 , 58 , 59 , 60 , 61 , 62 , 63 ,
48 , 49 , 50 , 51 , 52 , 53 , 54 , 55 ,
40 , 41 , 42 , 43 , 44 , 45 , 46 , 47 ,
32 , 33 , 34 , 35 , 36 , 37 , 38 , 39 ,
24 , 25 , 26 , 27 , 28 , 29 , 30 , 31 ,
16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 ,
8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 ,
0 , 1 , 2 , 3 , 4 , 5 , 6 , 7
}

Square mirroring lookup from white's perspective.

Indexed by 0–63 board square index. Returns the mirrored square index as if the board were flipped vertically. Useful for symmetrical evaluation and move generation.

Definition at line 23 of file board_data.cpp.

Referenced by mirrorBoardPosition().

◆ pieceColor

int pieceColor[13]
Initial value:
@ WHITE
Definition defs.h:44
@ BOTH
Definition defs.h:44
@ BLACK
Definition defs.h:44

Color of each piece type.

Indexed by piece constant (EMPTY, wP, wN, ..., bK). Possible values: WHITE, BLACK, or BOTH (for EMPTY).

Definition at line 13 of file board_data.cpp.

Referenced by AddPiece(), ClearPiece(), generateAllCaptures(), generateAllMoves(), isBoardStateValid(), isSquareAttacked(), MovePiece(), takeMove(), and updateListsMaterial().

◆ pieceToCharacter

char pieceToCharacter[] = ".PNBRQKpnbrqk"

Maps piece, side-to-move, rank and file to their character symbol.

For example: black king = 'k', white pawn = 'P', file 1 = 'a' etc.

Definition at line 3 of file board_data.cpp.

Referenced by printBoardState().

◆ pieceValue

int pieceValue[13] = { 0, 100, 325, 325, 550, 1000, 50000, 100, 325, 325, 550, 1000, 50000 }

Material value of each piece type.

Indexed by piece constant (EMPTY, wP, wN, ..., bK). Value is in centipawns, e.g., pawn = 100, queen = 1000, king = 50000.

Definition at line 12 of file board_data.cpp.

Referenced by AddPiece(), ClearPiece(), isBoardStateValid(), and updateListsMaterial().

◆ rankToCharacter

char rankToCharacter[] = "12345678"

Definition at line 5 of file board_data.cpp.

◆ SideChar

char SideChar[] = "wb-"

Definition at line 4 of file board_data.cpp.

Referenced by printBoardState().