Catherine is a chess engine written in C++ that focuses on efficient bitboard-based move generation and attack calculations. The project is currently in development, with the following features implemented so far:
- The chessboard is represented using a 64-bit integer (
U64), where each bit corresponds to a square on the board. - Bit manipulation techniques are used for efficient move generation and attack calculations.
- Functions to generate attack masks for various pieces:
- Pawn Attacks: Calculates possible pawn attacks based on the side (white or black).
- Knight Attacks: Generates all possible knight moves from a given square.
- King Attacks: Generates all possible king moves from a given square.
- Bishop Attacks: Calculates diagonal attacks for bishops.
- Rook Attacks: Calculates horizontal and vertical attacks for rooks.
- Queen Attacks: Combines bishop and rook attacks to calculate queen moves.
- Functions to calculate attacks dynamically, considering blockers (other pieces on the board):
- BishopAttacksOnTheFly
- RookAttacksOnTheFly
- QueenAttacksOnTheFly
- Bit Manipulation Macros:
getBit,setBit, andpopBitfor efficient bitboard operations.
- Bit Counting:
count_bitsto count the number of set bits in a bitboard.
- Least Significant Bit Index:
getLeastSignificant1stBitIndexto find the index of the least significant set bit.
- Occupancy Calculation:
setOccupancyto generate occupancy bitboards based on attack masks.
- Implemented efficient magic number generation for rooks and bishops.
- Used to speed up attack lookups by indexing precomputed attack tables via magic numbers.
- Added a custom XORWOW pseudo-random number generator.
- Enhances randomness for bitboard occupancy generation and future Zobrist hashing needs.
- Optimized initialization of knight and king attack patterns (leaper attacks).
- Improved dynamic attack generation for sliding pieces considering blockers.
- A
printBitBoardfunction to visualize bitboards in a human-readable format.
- Refactor the code to separate attack tables and on-the-fly attack generation into their respective files for better modularity.
- Implement move generation and validation.
- Add Zobrist hashing for board state representation.
- Develop a search algorithm (e.g., Minimax with Alpha-Beta pruning).
- Create a user interface for playing against the engine.
This project is currently under development and does not have a license yet.
Contributions are welcome! Feel free to fork the repository and submit pull requests.