Computer Chess Club Archives




Subject: Bitboard question

Author: Inmann Werner

Date: 13:41:35 12/02/98

Analyzing my program, I found, that it spends most time in the routine detecting
if the king is in check.
I think, using Bitboard Representation will speed up a lot, and using Bitboards
for this at the start will increase my learning.
After some thinking and reading, I have some nice working routines but one big

I have a Bitboard with one Bit set to one, all others to zero. Now I want to
know the number of the bit, counted from the "right side".
Example: 64 should be 7 (or 6?) cause its the 7th (or 6th) bit.
I programmed some routines which are more than bad. Is there a simple, but fast
routine available? Please help!

Second question.
I will work with lookup tables. Cause I do not want to use rotated bitboards (at
the beginning) I came to a "trick" for sliding figures.

After some ANDs and ORs I know the Position of the king and the "attacking" rook
for example. Now I have to find, if another figure blocks the attacking. With
some other ANDs and XORs I have all possible "blockers" in a bitboard. Now I
"AND" it with an attacktable which is defined as following.
BITBOARD ATTACKTABLE[64][64]. In it are all BITBOARDS where all possible
blocking Positions are in between the king and the attacking rook.
Thats it.

Is this a really bad idea? Any suggestions.


PS: I know, I "invite" old known things, but I want to understand what I do.

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