Author: Dann Corbit
Date: 19:52:06 06/17/02
Go up one level in this thread
On June 17, 2002 at 22:39:12, Adriano Bedeschi de Souza wrote:
>WOW, whats wrong with my rotates?
>
>BitBoard rotate45Right(BitBoard *board) {
>
> int square;
> BitBoard rotated45Right = 0;
>
> for(square = 0; square < 64; square++) {
> if((*board) & mask[square]) {
> rotated45Right |= mask[rotated45Right_map[square]];
> }
> }
> return rotated45Right;
>}
First, you are doing at least twice as many rotates as needed. When you get
down to a sparse board, potentially 32 times as many rotates as needed.
(Realistically, 21 times as many as needed for 3 pieces because it is pointless
to maintain rotated bitboards with 2 kings on the board -- besides which the
game is drawn by lack of force).
More like this:
while (p = Get_Next_Piece(bitboard))
{
Rotate45...
Remove_Piece(bitboard, p);
}
return rotated...
Also, you should do it incrementally, if you are not already doing that. In
other words -- if you move a bishop remove the bishop from all bitboards at its
former position then place it on all the bitboards in the new location. No need
to do the whole board over and over piece by piece.
This page took 0.01 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.