Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Bitboard board representation

Author: Vasik Rajlich

Date: 03:44:51 01/14/05

Go up one level in this thread


On January 13, 2005 at 17:18:46, Eric Oldre wrote:

>I have a rotated bitboard based engine. (Latista)
>
>My board representation looks like the following.
>
>//piece types
>typedef enum {
>	PIECEEMPTY,
>	PIECEWPAWN, PIECEWKNIGHT, PIECEWBISHOP, PIECEWROOK, PIECEWQUEEN, PIECEWKING,
>	PIECEBPAWN, PIECEBKNIGHT, PIECEBBISHOP, PIECEBROOK, PIECEBQUEEN, PIECEBKING,
>	};
>
>
>struct chessboard {
>public:
>	/* other stuff */
>
>	U64 bb_pieces[13]; //bitboards of piece locations
>
>};
>
>I noticed while reading the crafty source that Crafty uses a structure more like
>this.
>
>struct chessboard {
>public:
>	/* other stuff */
>	//bitboards of piece locations
>	U64 wPawns;
>	U64 wKnights;
>	U64 wBishops;
>	U64 wRooks;
>	U64 wQueens;
>	U64 wKings;
>
>	U64 bPawns;
>	U64 bKnights;
>	U64 bBishops;
>	U64 bRooks;
>	U64 bQueens;
>	U64 bKings;
>};
>
>so Prof. Hyatt can then use the following
>
>board->wPawns;
>instead of the equiv. in my engine
>board->bb_pieces[PIECEWPAWN];
>
>I've also noticed that Crafty is much faster than my engine, Although I'm sure
>that there are MANY MANY reasons for Crafty's better speed, I'm considering
>trying a switch to a board format similar to Crafty's.
>
>I know you can't perfectly predict what type of gain/loss I'd get, but I thought
>I'd ask if anyone thought It might be worth it.
>
>Or maybe you can tell me that it shouldn't make much difference and I'll save
>myself some time.
>
>Thanks for any advice you have,
>Eric

The two are certainly equivalent in speed.

Every now and then I make a little toy program to see if my compiler (MSVC) is
capable of some optimization. I have yet to find one which it wouldn't make.

Vas



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.