I am writing a C++ chess engine and I am looking for magic numbers for Little-Endian Rank-File Mapping bitboards to generate moves for sliding pieces.
The rival chess website gives magic numbers but not for the same board mapping.
The chess programming wiki gives some of the best magic numbers so far but is not exhaustive.
At the end I am looking for four things:
- occupancy mask for each square
- magic number for each square
- magic shifts for each square
- moves database array for each square
So I can use the following code to find the moves of the Rook on C3 (for instance):
bbBlockers = bbAllPieces & occupancyMaskRook[C3]
databaseIndex = (int)((bbBlockers * magicNumberRook[C3]) >> rookMagicShifts[C3])
bbMoveSquares = magicMovesRook[C3][databaseIndex] & ~bbFriendlyPieces