Computer Chess Club Archives


Search

Terms

Messages

Subject: An idea to generate rook moves without rotated BBs

Author: Severi Salminen

Date: 08:26:58 10/22/00


Hi!

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?

Severi



This page took 0.05 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.