Author: Tony Werten
Date: 00:12:26 03/03/06
Go up one level in this thread
On February 26, 2006 at 16:04:13, Gerd Isenberg wrote:
>Applying the old trick - not using the outer squares of the masked occupied ray
>- makes perfect 6-bit range hashing possible. Most often there are only 32
>occupied states per ray - only if the source is an outer square, there are 64
>states on a eight square ray:
>
> BitBoard preCalulatedAttacks[64][4][64];
>
> struct SMagicMask {
> BitBoard mask;
> BitBoard magic;
> };
>
> // sq ::= 0..63 square index of a sliding piece
> // dir ::= 0..3 kind of ray (two diagonals, horicontal, vertical)
> occIdx64 = (occupiedBB & mm[sq][dir].mask) * mm[sq][dir].magic) >> 58;
> attacks = preCalulatedAttacks[sq][dir][occIdx64];
>
>Generated mm-values below in a separate longer post...
I can confirm your findings. There are a few points however.
I couldn't get your values to work, in a few cases the magic number seemed to
map different bitboards to the same index.
I then run the deBruijn generator myself, to get stuck on 40 values or so, for
wich it couldn't get a magic number.
Then I just pumped random number into my checkMagicNumber() and within 10 milion
tries, I got a complete set of magic numbers ?!
I have implemented them in XiniX, ran a couple of searches with a check wether
the same moveBB was generated, and it works.
It's a bit faster than my (strangly) rotated bitboards on a 32 bit machine. On
64bit it will be way faster, since a lot of time is now spend in
_allmull(BB,BB) which isn't needed on 64bit.
Tony
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.