can be used for both bishop and rook magic number search
if you want to search for bishop magics, compile and then run with --bishop argument
it will tell you about newly found magics and how they affect the tablesize for their square
every 5 seconds it dumps the entire magics array too:
Best magics i found (i spent like 10 minutes searching) (they are in little endian format)
struct MagicEntry {
uint64_t magic;
int shift;
int tableSize;
};
MagicEntry rookMagics[64] = {
{0x0080064000201081, 52, 4096},
{0x0040021001406000, 53, 2048},
{0x2080200070001880, 53, 2048},
{0x8100100100542088, 53, 2048},
{0x8e00042008120110, 53, 2048},
{0x4b00082400021100, 53, 2048},
{0x02000200040800b1, 53, 2048},
{0x0500028608402100, 52, 4096},
{0x9800800299214000, 53, 2048},
{0x0402002200810050, 54, 1024},
{0x0005001045002001, 54, 1024},
{0x0004801800d00280, 54, 1024},
{0x002900080101504c, 54, 1024},
{0x100d000c00880300, 54, 1024},
{0x2023808001003a00, 54, 1024},
{0x0101000182224100, 53, 2048},
{0x0004808000214000, 53, 2048},
{0x0011020049220080, 54, 1024},
{0x6288220040108203, 54, 1024},
{0x0222818008025002, 54, 1024},
{0x4004008080040800, 54, 1024},
{0x0500808012000400, 54, 1024},
{0x4012050100020004, 54, 1024},
{0x00000a0001840445, 53, 2048},
{0x4200800180284002, 53, 2048},
{0x001080a100400500, 54, 1024},
{0x0402500480200480, 54, 1024},
{0x2100100280080081, 54, 1024},
{0x0048010100110c08, 54, 1024},
{0x6000040080800200, 54, 1024},
{0x0226088400010210, 54, 1024},
{0x0018802680014100, 53, 2048},
{0x3000804000801024, 53, 2048},
{0x8110022001404008, 54, 1024},
{0x0800500080806000, 54, 1024},
{0x0880081042002200, 54, 1024},
{0xa800850091000800, 54, 1024},
{0x0101120080800400, 54, 1024},
{0x0000100804000122, 54, 1024},
{0x0004004286000c01, 53, 2048},
{0x0028400280228000, 53, 2048},
{0x0300c00081010020, 54, 1024},
{0x4020001000858020, 54, 1024},
{0x1002000810420020, 54, 1024},
{0x03820020180e0010, 54, 1024},
{0x0404040002008080, 54, 1024},
{0x3000aa1810040015, 54, 1024},
{0x4100010064920004, 53, 2048},
{0x6100204008801180, 53, 2048},
{0x010c2010004000c0, 54, 1024},
{0x8040402003001900, 54, 1024},
{0x0302001008224200, 54, 1024},
{0x4201000800308700, 54, 1024},
{0x0010800400020080, 54, 1024},
{0x2004500208031400, 54, 1024},
{0x0000800100005280, 53, 2048},
{0x00a02202450080b2, 52, 4096},
{0x808a220700401282, 53, 2048},
{0x2200200040090011, 53, 2048},
{0x2201000409201001, 53, 2048},
{0x1002010c08102042, 53, 2048},
{0x1d01000804000201, 53, 2048},
{0x01000802011000cc, 53, 2048},
{0x800081002088c402, 52, 4096}
};
constexpr MagicEntry BishopMagics[64] = {
{0x4040082704028010, 58, 64},
{0x000218c813004087, 59, 32},
{0x40849c0082004061, 59, 32},
{0xd012408102000840, 59, 32},
{0x00820a1000000000, 59, 32},
{0x0201092031000000, 59, 32},
{0x4002021082090403, 59, 32},
{0x0001004804040a41, 58, 64},
{0x000a292208520402, 59, 32},
{0x008014051c250e03, 59, 32},
{0x00501c0802014800, 59, 32},
{0x830104104a002002, 59, 32},
{0x0100908820201030, 59, 32},
{0x00c0044108400214, 59, 32},
{0x10007400a208600d, 59, 32},
{0x0000012101105001, 59, 32},
{0x0204082254840802, 59, 32},
{0x1004003004088420, 59, 32},
{0x0461120802006200, 57, 128},
{0x0104830802004100, 57, 128},
{0x2404028480a00000, 57, 128},
{0x4402000088040220, 57, 128},
{0x0082000103092189, 59, 32},
{0x00820c0041442c00, 59, 32},
{0x001018a4414a0400, 59, 32},
{0x0002060650040800, 59, 32},
{0xc0a8880010004550, 57, 128},
{0x4008080042620020, 55, 512},
{0x3201001081004001, 55, 512},
{0x004040806510100c, 57, 128},
{0x6048028201040101, 59, 32},
{0x1000408382060100, 59, 32},
{0x0011201005220400, 59, 32},
{0x090082100c200404, 59, 32},
{0x3020402800100d40, 57, 128},
{0x0082008400020120, 55, 512},
{0x00040100700c00c0, 55, 512},
{0x8210204080011004, 57, 128},
{0x0f07020600041100, 59, 32},
{0x0003040020408210, 59, 32},
{0xea0c023842002c10, 59, 32},
{0x0494012410014a01, 59, 32},
{0x2017004022003004, 57, 128},
{0x0002401414000800, 57, 128},
{0x4404400091000200, 57, 128},
{0x0624008401008810, 57, 128},
{0x0d0210060a000280, 59, 32},
{0x0104440042000040, 59, 32},
{0x0002080212d08000, 59, 32},
{0x0001410828220024, 59, 32},
{0x000000c200d01c20, 59, 32},
{0x00000000840c2000, 59, 32},
{0x000264080b040040, 59, 32},
{0x0018604431020470, 59, 32},
{0x0140022881010414, 59, 32},
{0x508810118a004981, 59, 32},
{0x8400841101012012, 58, 64},
{0x2020008205b00400, 59, 32},
{0xc010071042080400, 59, 32},
{0x00044080649c0400, 59, 32},
{0x0090502051120202, 59, 32},
{0x2002002002060a00, 59, 32},
{0xf010905050008284, 59, 32},
{0x00848804b8018100, 58, 64}
};