Computer Chess Club Archives


Search

Terms

Messages

Subject: Question to Alessandro Damiani

Author: Alvaro Jose Povoa Cardoso

Date: 12:44:27 03/25/02


Hi,
you posted an interesting message bak in 1997 at rec.games.chess.computer about
avoiding rotated bitboards. I understood the bishops case but not the rooks
case, in particular the vertical attacks of a rook.

Below is the thread I'm referring about.
This is the part I woul like you to explain:

"To get the attack squares of a rook we follow the same procedure, but
here we don`t use an extra table like needed in 1.) and 2.) to extract
lower and upper half: shifting the bitboard is faster.
"

Thanks in advance,
Alvaro Cardoso






De:Alessandro Damiani (adamiani@g26.ethz.ch)
Assunto:Re: Rotated bitboards
Newsgroups:rec.games.chess.computer
View: Complete Thread (4 articles) | Original Format
Data:1997/10/31


Mats Forsén wrote:

> ]Hi all,
> ]
> ]I've decided to start anew on a chess engine.
> ]This time in win32 so I can use 64 bit integers
> ]and all available memory.. anyway.. my question
> ]is:
> ]
> ]I understand bitboards and flipped bitboards, but
> ]how do you put the diagonals in a bitboard?
> ]
> ]They do not have fixed widths or lengh.. agh..
> ]
> ]/ garnax@texoma.spamela.com (remove .spamela)

Why do people use rotated bitboards? We can calculate the index to the
table with all possible attack squares in a simpler way:
Consider the bitboard with all pieces on it, we call it ALLPIECES. Now,
we want to generate all attack squares of a bishop which is on square s.

We devide the bitboard at row(s) in an upper and a lower half and look
at them independently:
1.) upper half: extract the upper diagonals at s by and-ing ALLPIECES
and the upper diagonals-bitboard you read from a table. We or all 8 rows
of the resulting bitboard and get so an 8 bit index i. We access the
first table with AttackFromBishop_DiagonalsUp[s,i], and we get the upper
part of the attack squares of a bishop at s.

2.) lower half: same work. Accessing
AttackFromBitshop_DiagonalsDown[s,j], j is the index of the lower
diagonals at s.

3.) We or both results and get all attack squares. Easy, isn`t it?


To get the attack squares of a rook we follow the same procedure, but
here we don`t use an extra table like needed in 1.) and 2.) to extract
lower and upper half: shifting the bitboard is faster.


Bye bye

Alessandro



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.