Chess Engine 8x8
2026-01-10
Edited: 2026-03-07
Implementation
Very simple implementation, see below
int piece[64] = {
BROOK, BKNIGHT,BBISHOP,BQUEEN, BKING, BBISHOP,BKNIGHT,BROOK,
BPAWN, BPAWN, BPAWN, BPAWN, BPAWN, BPAWN, BPAWN, BPAWN,
EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY,
EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY,
EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY,
EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY,
WPAWN, WPAWN, WPAWN, WPAWN, WPAWN, WPAWN, WPAWN, WPAWN,
WROOK, WKNIGHT,WBISHOP,WQUEEN, WKING, WBISHOP,WKNIGHT,WROOK
};Using a square-centric representation is easy and intuitive, but when using these for chess engine move generation, long and nested loops are often required.
While you can pair this with a vector attack (see Chess Engine Board Representation), for efficiency and less loops, it is much more common to use a bitboard for move generation and then use this for square lookups.