Opinions requested for new move gen idea
Posted: Sun Mar 03, 2019 7:12 am
What I want to do does not require a bitboard engine. I just need speed so this board[64] approach is what I have come up with.
IN PSEUDO CODE
Assuming the fs is b1 = 1 then the data to generate bishop moves starts at index 7. After that the code is simple enough to understand. My questions are will this approach be fast and what is the simplest way to initialize the data structure? The advantages would seem to be no edge test needed and one loop instead of two.
Thanks in advance!
IN PSEUDO CODE
Code: Select all
constexpr auto u32 = unsigned __int32;
typedef struct {
u32 nxtTs;
u32 nxtDr;
u32 ts;
} tss;
u32 idxB[64] = { 0, 7, 14};
tss toSq[] = {
{ 1, 0, 9},
{ 2, 0, 18},
{ 3, 0, 27},
{ 4, 0, 36},
{ 5, 0, 45},
{ 6, 0, 54},
{ 0, 0, 63},
{ 8, 13, 10},
{ 9, 13, 19},
{10, 13, 28},
{11, 13, 37},
{12, 13, 46},
{13, 13, 55},
{ 0, 0, 8},
}
case bishop:
i = idxB[fs]; // fs = 1, i = 7
do {
ts = toSq[i].ts;
type = action[board[ts]].type;
switch (type) {
case EMPTY:
AddMove(fs, ts);
i = toSq[i].nxtTs;
break;
case ENEMY:
AddCapture(fs, ts);
i = toSq[i].nxtDr;
break;
case FRIEND:
i = toSq[i].nxtDr;
break;
}
} while (i);
Thanks in advance!