i am interested in what you are thinking about the following...(rook/queen shifts as example)
Code: Select all
/*
#define MSK_R(OCC,SQ) (OCC & msk_r[SQ])
#define MAGIC_R(OCC,SQ) ((MSK_R(OCC,SQ) * mgc_r[SQ]) >> shr_r[SQ])
// a normal shift set...
extern const UI_08 shr_r[ID_64] =
{
52,53,53,53,53,53,53,52,
53,54,54,54,54,54,54,53,
53,54,54,54,54,54,54,53,
53,54,54,54,54,54,54,53,
53,54,54,54,54,54,54,53,
53,54,54,54,54,54,54,53,
53,54,54,54,54,54,54,53,
53,54,54,53,53,53,53,53
};
*/
//optimal shifts
extern const UI_08 shr_r[ID_64] =
{
52,53,53,53,53,53,53,52,
53,54,54,54,54,54,54,53,
53,54,54,54,54,54,54,53,
53,54,54,54,54,54,54,53,
53,54,54,54,54,54,54,53,
53,54,54,54,54,54,54,53,
53,54,54,54,54,54,54,53,
52,53,53,53,53,53,53,52
};
extern const UI_64 mgc_r[ID_64]=
{
0x0080001020400080, 0x0040001000200040, 0x0080081000200080, 0x0080040800100080,
0x0080020400080080, 0x0080010200040080, 0x0080008001000200, 0x0080002040800100,
0x0000800020400080, 0x0000400020005000, 0x0000801000200080, 0x0000800800100080,
0x0000800400080080, 0x0000800200040080, 0x0000800100020080, 0x0000800040800100,
0x0000208000400080, 0x0000404000201000, 0x0000808010002000, 0x0000808008001000,
0x0000808004000800, 0x0000808002000400, 0x0000010100020004, 0x0000020000408104,
0x0000208080004000, 0x0000200040005000, 0x0000100080200080, 0x0000080080100080,
0x0000040080080080, 0x0000020080040080, 0x0000010080800200, 0x0000800080004100,
0x0000204000800080, 0x0000200040401000, 0x0000100080802000, 0x0000080080801000,
0x0000040080800800, 0x0000020080800400, 0x0000020001010004, 0x0000800040800100,
0x0000204000808000, 0x0000200040008080, 0x0000100020008080, 0x0000080010008080,
0x0000040008008080, 0x0000020004008080, 0x0000010002008080, 0x0000004081020004,
0x0000204000800080, 0x0000200040008080, 0x0000100020008080, 0x0000080010008080,
0x0000040008008080, 0x0000020004008080, 0x0000800100020080, 0x0000800041000080,
0x00FFFCDDFCED714A, 0x007FFCDDFCED714A, 0x003FFFCDFFD88096, 0x0000040810002101,
0x0001000204080011, 0x0001000204000801, 0x0001000082000401, 0x0001FFFAABFAD1A2
};
(it's now few months ago i worked with it, and i tested it in different ways)
i wasnt able to find any "buggy" entries (on index collision).
So why not using the optimal shift. (in hope it is correct what i say, try it out )
