Sliding Piece Generation in Chess Engine
So I've been having some trouble wrapping my head around an issue. I'm currently writing a bitboard based chess engine in Java (its been a ride figuring everything out). So far all of the pawn/king/knight moves work as expected and without bugs.
What I need help understanding is sliding piece move generation. I have generated the array of empty board moves for each square / piece. From my current understanding I also need to develop an array that contains each possible occupancy on each square as well-- and then somehow look up that array based on a variety of methods.
Is this way of thinking about it correct? Is it a matter of picking every number from 0 to 2^63 and xor'ing it with the move bitboard for that square and then storing that with some method (magic/rotated bitboards) to initialize the array and accessing it the same way at run time?
Pseudocode and explanations are much appreciated. (I'm using the >>> by the way).
There are many ways to generate sliding piece moves for bitboards, with varying performance and complexity. Many of them are listed here.
Probably the fastest and most common one is magic bitboards, which uses multiplication of bitboards with "magic" precalculated values to generate the possible moves in all four directions at once. The drawback is that it uses very large lookup tables. This probably shouldn't be your first implementation as it's more complicated.
Obstruction difference and hyperbola quintessence are not much slower than magic bitboards, while easier to implement.
Even simpler and slower is dumb7fill which is a loop in every possible direction, without requiring any lookup tables.
链接地址: http://www.djcxy.com/p/84674.html上一篇: negamax算法..有什么不对?
下一篇: 国际象棋引擎中的滑块生成