Computer Chess Club Archives




Subject: Re: An idea to generate rook moves without rotated BBs

Author: Rafael Andrist

Date: 10:43:00 10/22/00

Go up one level in this thread

On October 22, 2000 at 11:26:58, Severi Salminen wrote:

>I have started again from scratch to program a chess engine, now with C. I came
>to this solution to generate rook moves without rotated bitboards:
>I wont show you everything :) but here is some code from my mov_gen routine. E
>holds all the pieces on board, j is the position of our Rook (0=H1 and 63=A8). F
>is an empty bitboard and D holds the horizontal squares which we can move to
>(calculated before this)
>// Aligning the file info to right corner of bitboard and clearing all other
>// bits:
>        E=(E>>(j&7))&0x0101010101010101;
>        for(k=0, F=0;k<8;k++)
>  	{
>	   F|=E;
>	   E>>=7;
>	}
>	F&=0xff;
>//After the loop F holds the file info and we can fetch the squares from
>//a pre-compiled table and OR them with the horizontal destination squares
>	D|=FileMoves[j>>3][F]<<(j&7);
>What I'd like to know if anyone has tried to compare this method with rotated
>bitboards and I'd like to know if this is a lot slower (or faster;). I _must_ do
>this loop (which can be optimized a little...) for every rook but I don't have
>to update rotated bitboards at all after I make moves. Maybe the net speed is
>quite equal and depends on move ordering and so on...Opinions?

I had this idea too. I haven't count exactly, but I think if you must do that 6
times (4 rooks + 2 queens) it would be slower. I generate the rotated bitboards
with inline assembly.

This page took 0.03 seconds to execute

Last modified: Thu, 07 Jul 11 08:48:38 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.