Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Bitboards Explained?

Author: James Robertson

Date: 11:19:08 04/19/99

Go up one level in this thread



>      I have a quick question about bitboards: Say I'm generating the knight
>moves and I come up with the attack board for a knight... I then have to parse
>that board to find out which bits are true so I can come up with the move list.
>I currently just loop through all of them (the bits in the attack board) and see
>which ones are lit up but it seems to me like this is very inefficient yet I
>can't think of any other way... is there one?

Yes. In PCs, you can use the assembler commands bsf and bsr, which find the
first and last set bit, respectively. Look at Crafty's x86.cpp (or vcinline.cpp;
I can't remember which) for a very efficient implementation of these commands.
Another way is to use an array. Crafty and Arasan 4.1 (maybe 5.0 too)
demonstrate use of this. I use the bsf/bsr.

James



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.