Understanding “o^(o-2r)” formula for generating sliding piece moves using unsigned bitboards?
问题 What I Am Trying To Do I am trying to perform some bitwise operations to create a chess engine. To make this engine, I need to be able to generate moves for pieces, like rooks. There is a handy formula for creating a bitboard of squares available for the rook to move to: bitboardOfOccupiedSquares ^ (bitboardOfOccupiedSquares - 2 * bitboardOfPieceToMove) . Consider the following chess board position: I am trying to generate all of the squares that the rook on h1 can move to. So this should be