It recently came to my attention that it would be possible to use bitboard techniques without lookup tables, just using the ALU's carry propagation. If a word would contain the occupancy of a ray (bits set to 1 for each occupied square),
Code: Select all
typedef int BitRay; BitRay sq, oc; int ray; sq = squares[orientation][fromSqr]; // square-number to bit mapping ray = rayNumber[orientation][fromSqr]; // lookup dictionary for rays oc = occupancy[ray]; // relevant part of the 'occupancy' bitboard oc &= ~sq; // clear from-square oc -= sq; // flip all bits upto and including nearest occupied oc ^= occupancy[ray]; // set flipped bits oc &= ~sq; // remove from-square
So there would be no need for table lookup of the attack sets. Just a few tables with 4*boardArea (byte-size) elements, to map (orientation, square) pairs on ray numbers of the board representation (which in itself would consist out of 4*boardWidth rays, (actually boardWidth + 3*boardHeigt if boardWidth > boardHeight), the diagonal rays packed in the same way as in rotated bitboard), and a table of 4*boardArea elements the length of a ray to map out the bits corresponding to a given square in the ray of that orientation.
Has this type of representation ever been used for normal Chess (i.e. 8x8 boards)?