Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: De Bruijn Sequence Generator

Author: Gerd Isenberg

Date: 15:49:48 12/30/03

Go up one level in this thread


On December 30, 2003 at 16:48:04, Russell Reagan wrote:

>On December 30, 2003 at 16:14:58, Gerd Isenberg wrote:
>
>>Currently for Athlon-32 i still use inline assembler version with jnz after
>>lower bsf! With my "new" Opteron-Approach with a complete different bitboard
>>infrastructure with respect to (SSE2) fill-algorithms, i will try to avoid
>>bitscan at all and to extract bits with x & -x only.
>>
>>Therefore my interest to find a fast hashfunction for move indices.
>
>Hi Gerd,
>
>Nice to see you are still working on these kinds of things. I have a question.
>It seems like a simple bitscan and table lookup would be very fast already. Is
>your new approach significantly faster?

Hi Russell,

don't know, i guess a bit faster, but not significantly -
it safes slow bsf-instuctions, x & -x is cheaper.
One 64-bit <sub, mul, shr,[add,sub]> per move to get an unique index in an 8K
range, including full piece information.

> For instance, this seems fast to me
>(especially on 64-bit hardware):
>
>Bitboard hash_key_lookup_table[64];
>int lsb ( Bitboard b ); // returns least significant bit
>
>// Compute from_bb and to_bb using x & -x trick in move generation function
>
>move->from_bb = ...;
>move->to_bb   = ...;
>
>// In your make move function to update the hash key...
>hash_key ^= hash_key_lookup_table[ lsb(move->from_bb) ];
>hash_key ^= hash_key_lookup_table[ lsb(move->to_bb) ];

what about using some huge precalculated lookups:

Bitboard hash_key_lookup_table[8192];
hash_key ^= hash_key_lookup_table[ move->key ];

or even with captured piece information
Bitboard hash_key_lookup_table[6*8192];

May be not so cache-friendly?
Anyway - speed is not the main issue here.

I like the idea of unique move keys with respect to the piece and not only the
coordinates. One possible side effect could be a more "accurate" history
heuristic. Only knights have disjoint "own" coordinates. Rooks and bishops are
disjoint. But move coordinates like e2e3 are valid with pawn, rook, queen and
king ;-)

Gerd




This page took 0.01 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.