Instead of having:
Code: Select all
struct SlidingMoveNode
{
TSquare tosq;
SMove move;
SlidingMoveNode* pNext[2];
};
SlidingMoveNode slidingMoveTable[1456+896+560]; /* queen, rook, bishop -> 2912 * 16 = 46592 bytes 45.5 Kib */
SlidingMoveNode* slidingMoveHead[3][64];
Code: Select all
U64 slidingMoveTable[1456+896+560]; /* 2912 * 8 = 23296 22 KiB */
int slidingMoveHead[3][64];
I use a U64 instead of a struct because it allows us to do some relatively cheap decompression. My encoding is this:
Byte 0 - the to square plus two filler bits
Byte 1-2 - the next index for the table if this square is empty
Byte 3-4 - the next index for the table if this square has a piece on it (i.e. next direction)
Byte 5-7 - filler bits - perhaps you could use them as a REBEL-type attack table (probably not cheap)
In essence it is just a version of the above with no pointers and about half the size.
Matthew:out
