Author: milix
Date: 15:24:29 01/06/06
Go up one level in this thread
On January 06, 2006 at 12:49:25, frogMeSebastian wrote:
>Hello all
>
>I have read a lot about the idea of bitboards and its use in chess programming,
>I fail, however, to get the idea of how to implement it in C.
>
>I have got something like this:
> unsigned long long int bb_WhitePawns
Depending on the compiler, you might have to define a 64bit integer as
unsigned __int64 bb_WhitePawns;
>
>Now let's say there is one single Pawn on A1. If I simply do
> bb_WhitePawns = 1000..0 (63 0)
1000000000000000000000 and whatever is not a number in binary arithmetic in C,
it is in decimal arithmetic.
>Then
> printf(" %i", bb_WhitePawns >> 1);
>would not return '0100..00' but some nonsense integer value.
>
You cannot printf a 64bit integer using "%d" (by the way, what is "%i"?)
Try to cast to double first (platform independed)
printf("%.0f", (double)(bb_WhitePawns));
>It seems to me that the compiler does not interprete the value as a 64-bit-word.
>What am I doing wrong?
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.