Skip to content

ZeroDay0101/BitFusion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

β™ŸοΈ Java Chess Move Generator (Magic Bitboards) A high-performance chess move generator written in Java, utilizing magic bitboards, bitshifting, and precomputed magic numbers to efficiently generate legal moves, especially for sliding pieces like rooks, bishops, and queens.

πŸš€ Key Features

⚑ Fast move generation using 64-bit long bitboards

🧠 Magic bitboards for constant-time rook and bishop attack generation

πŸ”§ Bitwise operations and shifting for optimal performance

πŸ“ Modular, clean Java architecture ready for engine integration

βœ… Legal move filtering – ensures moves don’t leave the king in check

πŸ§ͺ Perft testing framework – verifies move correctness via node counting

πŸ”— UCI move serialization – outputs standard strings like e2e4, e7e8q

πŸ§ͺ Six JUnit tests featuring complex, bug-catching positions to ensure accuracy and robustness

πŸ€– Suitable for integration into chess engines and AI

πŸ“š What Are Magic Bitboards? Magic Bitboards are a technique to speed up attack generation for sliding pieces. Instead of scanning all directions manually, this method:

Masks relevant squares around a piece.

Multiplies the occupancy by a special "magic number".

Shifts the result to generate a unique index.

Uses that index to look up a precomputed attack bitboard.

This enables near-constant time move generation with no loops.

πŸ› 

βœ… Pawns (non-magic, bitwise forward capture/generate)

βœ… Knights (bitmask lookups)

βœ… Kings (bitmask lookups)

βœ… Bishops (magic bitboards)

βœ… Rooks (magic bitboards)

βœ… Queens (combo of rook + bishop)

⚑ Performance

Rook/Bishop/Queen moves in O(1) time

πŸ“ License MIT License – free to use, modify, and distribute.

About

Chess move generator project writen in java

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages