The code you provided is like the absolute basics of any bitboard engine. The slow part is generating and storing the moves. I would be very curious if you could go into more detail about how you are able to avoid that and perhaps provide some pseudo code as well.dangi12012 wrote: ↑Sat Nov 06, 2021 2:47 pm
What the huge advantage is: When you change N squares in a mailslot you have to index every square sequentially. When you change N squares in a bitboard it is a single x64 instruction.
That allowes move pruning and check evasion and pins - and nasty pins like the horizontal EP pins to never take more than 2 instructions to be resolved. And all that with less space and time compared to arrays.
Not that its useful but my prime example is : Moving all 8 pawns up one rank on an empty board:Checking how many are ready to be promoted now:Code: Select all
Wpawns <<= 8;
Now how would that look in mailslot? I am asking because I am sure it would be more than 3 instructions long for 8 pawns and 8 checks for all 8 promotion squaresCode: Select all
int promo = BitCount(WPawns & LastRank);
![]()
Code: Select all
// after generating the possible_moves bitboard with one or two instructions, this is the slow part
while(possible_moves) {
Square to_square = PopLsb(possible_moves);
Square from_square = to_square - push_dir;
PutMoveToList(to_square, from_square);
}