Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Reversed vs. Rotated Bitboards

Author: Sune Fischer

Date: 10:26:02 01/28/02

Go up one level in this thread


On January 28, 2002 at 13:04:05, Sune Fischer wrote:

This is what I get for half the rook, similar stuff is done for the backwards
attacks using the reversed occupied bitboard.

BITBOARD RookAttacksForward(BOARD &occupied, char square)
{
	BITBOARD a,x,y;

	x=occupied>>square;  // shift board so square ends in lower left corner
	y=x&RANK1;           // mask out ewerything but the first rank
	a=y^(y-2);           // get the attacked bits on this rank
	y=x&FILE1;           // now mask so we get a clean first file
	y=y^(y-2);           // get the attacked squares
	a=a|(y&FILE1);       // add the attacked bits after masking with the file again
	a=a<<square);        // shift the attacked bits back (for ease of readability)

	return a;
}


..untested, but something along those lines.
Not entirely sure how to do it for the bishop, I guess we just shift to the
lower right corner when attacking north-west and lower left when attacking
north-east.

But what happens if x=0?
Will y then be 0 or something strange, the bitboard is unsigned so it should
remain 0 right?

-S.




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.