Magic Bitboard Core is a high-performance library for efficient attack computations in chess engines. It leverages Magic Bitboards to enable fast attack lookups for sliding pieces.
✅ Magic Bitboard lookup tables for bishops, rooks and queens
✅ Efficient attack computations for building fast move generators in chess engines
✅ Bitwise operations for ultra-fast computations
✅ Fully documented and unit-tested for reliability
This project is built with Java and Maven. To use it, clone the repository and build with Maven:
- Java 11+
- Maven
git clone https://github.com/T-Lak/MagicBitboardCore.git
cd MagicBitboardCore
mvn clean install
To compute pseudo-legal attacks for different pieces:
int square = 36;
long occupied = 0x0000001008000000L; // Some occupied squares
long attacks = Queen.getAttacks(square, occupied);
printBoard(attacks);
0 1 0 0 1 0 0 1 |8
0 0 1 0 1 0 1 0 |7
0 0 0 1 1 1 0 0 |6
1 1 1 1 0 1 1 1 |5
0 0 0 1 1 1 0 0 |4
0 0 0 0 1 0 1 0 |3
0 0 0 0 1 0 0 1 |2
0 0 0 0 1 0 0 0 |1
----------------+
A B C D E F G H
/src
├── main/java/bitboard
│ ├── attacks/ # Attack computation for all pieces
│ ├── lookup/ # Precomputed attack tables
│ ├── utils/ # Utility functions (e.g., bitboard printing)
├── test/java/bitboard # Unit tests
Run unit tests using Maven:
mvn test
If you find any issues or optimizations, feel free to open an issue or submit a pull request!
This project utilizes precomputed magic numbers from Shallow Blue.
This project is licensed under the MIT License.