Author: Sune Fischer
Date: 13:17:29 11/22/02
Go up one level in this thread
On November 22, 2002 at 13:20:35, Gerd Isenberg wrote: >>>To get an index eg. for history table or to get really the native square >>>coordinates without bitscans, some hashkey-function may help, as Steffan already >>>mentioned, that maps the two from and to bitboards to an integer range. >>> >>>I don't like div/mod, but had no better idea so far similar to Joel Veness >>>proposal to extract bits from a bitboard: >>>http://www.talkchess.com/forums/1/message.html?265543 >>> >>> (fromBB - toBB) mod 7961 >>> >>>gives unique numbers for each possible move. But the range is rather huge. There >>>should be something better... >> >>You have to know this trick for it to work, you need to know directions here. > >I'm dreaming of a hell fast inline: > > int func(BitBoard fromBB, BitBoard toBB) > >to get an unique integer value with the range of 1792 (or up 2048), where 3 bits >indicate the direction (Ok the latter is not so important and i would also >accept a range of 4096 :-) > >Then using a lookup table with from/to coordinates is a nice alternative to bit >scan. > >My best one so far with some shifts and signed mod (which i like to avoid) with >6395 is a range from -6382..+6382, which is 12764/1792 or more than seven times >so much space, my math skills are overemployed )-: I'm stranded too, the best I have is finding the file (assuming 1 bit set only): file_index=0xFF&((((fromBB>>32)|fromBB)>>16)|fromBB)>>8)|fromBB); should be a number from 0-255 with an one-to-one mapping from with the file. The rank is the other way, so it doesn't work that easily, perhaps some oddball shifting? -S. >Gerd
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.