Chess Bitboard AI
Engine: Unity
Project Type: University
I've been interested in chess as a programming problem for a while, even creating a (very bad) one for my A-Level computer science course work. My Master's degree gave me the oportunity to create one of these for a prototyping module where we had the freedom to researh and make anyting.
​
Features:
-
Bitboards
-
Lookup Tables
-
Magic Bitboards
-
Pseudo-Leval and Legal Move Generation
-
Pawn Promotion
-
Checkmate/Stalemate/Check
Technical Breakdown
Bitboards
A bitboard is a 64-bit number that represents a chess position. A chessboard has 64 squares, making this incredibly convenient. A bitboard can be either an occupancy bitboard or an attacking bitboard, the difference being an occupancy bitboard is where the pieces are, whereas an attacking bitboard is where the pieces can attack. This allows us to use bitwise operations to affect the entire chess board at the same time.
Bitwise operations can be used on a bitboard to be able to affect the entire board simultaneously. This is even faster as bitwise operations can also be run in parallel, whilst only using a small number of CPU instructions. This is extremely efficient and a lot faster than the common way of looping over an array of pieces. An example bitwise operation would be that AND can be used to see if a square is occupied or not as seen in this code below.
if (whitePiecesBitboard & squareMask)



