Author: Tord Romstad
Date: 01:14:46 06/13/04
Go up one level in this thread
On June 12, 2004 at 13:09:30, Gian-Carlo Pascutto wrote:
>const BITBOARD magic = 0x03f08c5392f756cdULL;
>
>const unsigned int magictable[64] = {
>0, 1, 12, 2, 13, 22, 17, 3,
>14, 33, 23, 36, 18, 58, 28, 4,
>62, 15, 34, 26, 24, 48, 50, 37,
>19, 55, 59, 52, 29, 44, 39, 5,
>63, 11, 21, 16, 32, 35, 57, 27,
>61, 25, 47, 49, 54, 51, 43, 38,
>10, 20, 31, 56, 60, 46, 53, 42,
>9, 30, 45, 41, 8, 40, 7, 6,
>};
>
>unsigned int FindFirst (const BITBOARD b) {
> const BITBOARD lsb = b & -b;
> return magictable[(lsb * magic) >> 58];
>}
I've been staring a this code for 15 minutes trying to figure out how it
works, but without success.
How does the FindFirst function above perform its magic?
Tord
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.