Author: Ross Boyd
Date: 17:43:07 10/16/04
Go up one level in this thread
On October 16, 2004 at 10:58:17, Ron Peterson wrote:
Hi Ron,
IMHO, Bitboard vs Offset is really a non-issue in terms of performance. Top
engines use either method and some even use a hybrid (Ruffian). Crafty and
Olithink are bitboard based and their code is downloadable. Offset examples are
TSCP (a good place to begin) and Fruit (very nice code and well designed, quite
strong too).
If you're writing an engine for the first time I would go with an offset method
as it is simpler to understand. Also, do some research on different board
layouts. There are many varieties and each have certain
advantages/disadvantages.
Some have borders to test for OFFBOARD and some use the 0x88 method to detect
OFFBOARD. And some have pre-calculated move lists for every piece on every
square (Gnuchess)... so no need to test for OFFBOARD.
In your example I see you are using a 2 dimensional board. You can probably
improve this by using one of the above one-dimensional schemes.
Good luck, have fun with it!
Ross
> I have seen some messeages about the use of bitboards for move generation.
>I use a offset approch for my move generator and I am pleased with the speed. I
>have enclosed a copy of my "gen_white_knight" code.
> My question is what type of speed increase wuold you expect to get in a
>move generator using bitboard? 50%? 100%?
> Thanks
>
>The following function accepts the next empty index for storage in an array of
>structures database. It returns the next empty spot after all knight moves have
>been calculated or -1 if the enemy king has been taken.
>
>gen_white_knight(int i,int j,int count,int ply)
>{
>
> int k,l,increment;
>
> for (increment=0; increment<16; increment+=2)
> {
> k = i + n_offset[increment]; /*static data table for offsets*/
> l = j + n_offset[increment + 1];
> switch (board[k][l])
> {
> case EMPTY:
> case BLACK_PAWN:
> case BLACK_KNIGHT:
> case BLACK_BISHOP:
> case BLACK_ROOK:
> case BLACK_QUEEN: store_move(i,j,k,l,0,count++,ply);
> break;
> case BLACK_KING: return -1;
> break;
> default: break;
> }
> }
> return count;
>}
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.