Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: BitBoards

Author: Dave Gomboc

Date: 07:00:20 05/29/99

Go up one level in this thread


On May 29, 1999 at 07:55:46, Frank Phillips wrote:

>What is the best way to extract the squares pieces are on from a piece-bitboard?
> For example, if whiteKnights is the bitboard representing where white knights
>are, how do you find the square the knights are on.  Looping through the 64 bits
>with a mask for each possible square on the board seems slow, even if you can
>break out once the bitboard is empty.

It does seem slow.  You'll get the most out of bitboards on processors with
operations like "find first one", at least if you're into using inline assembly.
:-)  Otherwise, you'll have to find some way to do this in software (there are
several known ways).

Something that is really important is to not be trying to "get at the actual
square" until its absolutely necessary... and depending on what you are doing,
sometimes you can find ways to do things so that you don't need to at all.

Crafty is bitboard-based, so its source code (if again available?) is worth a
look-see.

Dave



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.