Author: Robert Hyatt
Date: 20:52:53 04/22/98
Go up one level in this thread
On April 22, 1998 at 17:09:02, Bruce Moreland wrote: > >On April 22, 1998 at 16:57:00, Peter Fendrich wrote: > >>There seems to be different definitions of what rotated bitboards really >>are. I'm talking about rotating the diagonals. >> >>What should be called rotated? >> >>1) Rotate the board 45 degrees. Now we have 15 diagonals on 15 bytes. >> This would be truly rotating in my defintion. Not so good however, >> because we cant't use the 64 length bitboard to store it in. scratch this. bitboards are, by definition, 64 bits. So any mapping that leads to more than 64 bits is useless... >> >>2) Map the squares so that adjecent squares on the same diagonal >> recides on the same byte. >> This isn't really rotating, shouldn't it be called something else? >> Mapping? forget "bytes". that's not necessary. The trick is that squares on the same diagonal have to be mapped to adjacent bits in a word, nothing more or less. There are several such "mapping" approaches. I turn the board up on a corner (like a1) so that a1 is the first bit, a2/b1 are the next two bits, a3/b2/c1 are the next three, etc. To extract a diagonal, you need to know how far to shift the rotated bitmap to the right, and then which mask to extract the diagonal bits... or, do as I do and don't do the mask at all, just take 8 bits and use that (even though some diags are shorter, you can initialize tables so that the extra bits are effectively ignored... >> >> I do this by packing the rotated bitboard. Start with a1 which is the >> only square in the first diagonal. Put it togeteher with the nearest >> diagonal with 7 squares, that is a7-g1. Next byte will be a2-b1 >> concatenated with a6-f1. And so on. When looking at the square a2 one >> have to first mask away a6-f1. >> This works fine for me. >> nothing wrong with that at all... >>3) Are there other ways of rotating the diagonals? > >The "wind from the west" board would be as follows: Bit 0 is h1, bit >1-2 is g1..h2, bit 3-5 is f1..h3, bit 6-9 is e1..h4, etc. > >You don't have to treat the thing as an array of bytes, if you want to >get e1..h4 you can just AND the thing with 0x00000000000003C0. > >This fits in 64 bits and covers all the squares. > >This is Bob stuff. > >bruce
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.