Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Fastest Conversion from 0x88 board to 8x8 board representation

Author: Scott Gasch

Date: 15:06:53 07/06/01

Go up one level in this thread


On July 06, 2001 at 14:37:14, Artem Pyatakov wrote:

>I would like to save some memory in things like the history table, but I am
>using the 0x88 board representation, and I would like to sometimes convert these
>coordinates to a normal 8x8 board (so I could have a 64x64 array instead of
>128x128 array)... What is the fastest way to do this conversion?
>
>Thanks

Hi,

First, you can get by with 120x120 instead of 128x128... nothing will be in the
last 8 elements.

Second, I think this will be (very slightly) slower than just sucking it up and
using the larger history table.

With the larger table you waste about 40Kb of space (16Kb = 64x64x4 vs. 56Kb =
120x120x4).  But, assuming that the chance of a history table entry being in the
processor cache is low, you are paying for one memory access with the larger
table vs. a translation + one memory access with the smaller table.  Since
memory is cheap and I'm not programming chess-for-the-wrist-watch I don't care.
That said, I could be wrong (as usual).

As far as how to translate should you choose to... in essence you just want to
grab the six bits of real info out of a coordinate in 0x88 format.  If its legal
then bit 3 and bit 7 are clear.  So how about this:

c8x8 = (c0x88 & 0x7) | ((c0x88 & 0x70) >> 1);

Something like that at least.  Maybe you can play with reordering the operations
to save cycles.

Let us know if you see any speedup with smaller tables.  I'm curious as to your
results.

Scott





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.