Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: a question about initializing bitboards

Author: Robert Hyatt

Date: 11:52:20 01/08/03

Go up one level in this thread


On January 08, 2003 at 09:41:54, Uri Blass wrote:

>I want to initialize my pawn bitboards
>I started by doing for every square of a pawn
>
>pawnBB[color(square)]|=(1<<square);
>
>I changed it to
>pawnBB[color(square)]|=((Bitboard)1<<square);
>
>Do I need to do it?

yes you do.  1 by itself is going to default to an int, so 1<<x where X >= 32 is
going to produce a zero.  If you first cast 1 as a bitboard, then the shift will
work.
>
>I suspected that the program may give me wrong value based on replacing my
>perft command by a function that return perft|(1<<33) and I found that it
>returns the correct perft without adding 1<<31 and only after I changed it to
>(Bitboard)1 I got the right value.
>
>Uri



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.