Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Duh!

Author: Eugene Nalimov

Date: 16:56:51 05/14/99

Go up one level in this thread


On May 14, 1999 at 19:24:58, KarinsDad wrote:

>I didn't look at the original structure when I wrote this last message.
>
>The savings would be 3 bits not 4 in the structure, so the overall savings would
>be:
>
>0 EP  1 bit
>1 EP  2 bits
>2 EP  5 bits
>
>Oops!
>
>KarinsDad :)

Actually, we can do even better: if there is *no* EP, we can store '0' in a
header. If there *is* EP, we can store 1xxxx in a header, but we know values of
the 4 squares - 2 pawns and 2 empty ones, so we can don't store those *at all*,
just skip those fields when encoding a board. Total saving will be 2 bits in the
first case (1 bit instead of 3 in the header), and 4 bits in the second case
(header is 2 bits longer, but board is 6 bits shorter) compared to the first
suggested schema.

What is much more important, you can do something similar with castling status.
In your schema, you reserverd 8 bits in the header - 6 for location of the king
and 2 for possible castling directions. It's possible to replace it by something
smaller, e.g.
1) 0xxxxxx - castling not possible, and we have to store location of the king,
2) 01 - both casling are possible, so we know locations of king and both rooks,
3) 01x - only one castling is possible, so we know location of king and one of
the rooks.
In case 1 we save 1 bit, in case 2 - 14 bits, in case 3 - 7 bits.

It looks that I had a good practice when I invented a compact schema for TBs...

Eugene



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.