Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Minimum Number of Bytes - encode castling within kings coordinates

Author: Dieter Buerssner

Date: 04:43:51 12/24/03

Go up one level in this thread


On December 24, 2003 at 01:52:18, KarinsDad wrote:


>Standard encoding for a position with no captures yet yields:
>
>62 bit piece/pawn location
>12 bit kings and castling info
>30 bits (max) piece or pawn
>16 bits (max) pawn color
>48 bits (max) piece type and color
>1 bit side to move
>3 bits e.p. (if necessary, the other e.p. bit isn't needed)
>
>So, we are at 172 bits max for the normal encoding. Capturing a pawn with
>another pawn drops a pawn color bit and a piece/pawn bit, but there are now 3
>remaining pawns that could promote and change to pieces for a net gain of 4 more
>bits (+6 - 2), etc.

So already 176 bits for a general 31-men position, ..., 188 bits for 28 men (4
pawns captured, 12 promotions). In sight of this, the encoding of direct pieces
looks more attractive. 30 pieces/pawns. 3 conveniently fit in 10 bit (10^^3 <
2^^10), so no long arithmetics is needed. We don't need the 30iest piece (there
is only one legal material configuration with 32-men). Instead we could use it
as ep column.

1 (stm) + 12 (KK/castling) + 62 (location) + 100 (pieces+ep) = 175

Perhaps an efficient enumeration would be possible, to save one bit for the
location vector (less than half of all possible states are used, because a
maximum of 30 bits are set).

One could also save 2 bits for the ep. one ep-bit 3 for ep.column, one that
means "there is an opponent pawn left of the ep-column", if not, there must be
one right of it. There is no need to encode that pawn (also not in the location
vector). Also, 2 squares behind the ep-pawn must be empty, which can be left out
of the location vector. And then the pawn that just made a double step is
neither needed in the location vector nor in the piece list. So we are down to
173 bits. (one ep bit instead of a bit more than 3). Perhaps one could find a
method, to cleverly encode the ep-bit as an illegal position (only needed for 32
and 31 men).

> There are ways to decrease this, but they are tricky.

Are you refering to the problem with the promotions? Can you elaborate?

Regards,
Dieter



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.