Computer Chess Club Archives


Search

Terms

Messages

Subject: Question to Alessandro Damiani

Author: Alvaro Jose Povoa Cardoso

Date: 14:11:04 03/17/02


Hi,
I would like to ask if you would be so kind to explain me a detail on a post
you did back in 1997 about avoiding rotated bitboards.
I understood the bishops attacks but not the rooks vertical attacks.

Below is the thread on the subject.


this is the part I did not understand:
"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."

I don't get how we can shift the bits of the vertical rook attacks into an
horizonttal 8 bit index (a single byte).


Best regards,
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.