Author: Alex Boby
Date: 13:26:13 04/20/99
Go up one level in this thread
On April 19, 1999 at 14:19:09, James Robertson wrote: > >> 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 Sounds like bsf/bsr would be good for me too,.. but I looked through crafty's code and he seems to have whole functions written in assembler for bitboards. I don't know assembler and don't really have any intent on learning at this point, so I'm hoping there's an easier solution! I would be interested in seeing some other source with a more basic implementation of this method. If you know of any or if you could give me further tips for how to use these commands in C,.. that would be great. Also,.. what is this array method you speak of? Thanks
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.