Computer Chess Club Archives


Search

Terms

Messages

Subject: Even Better

Author: KarinsDad

Date: 17:22:04 05/14/99

Go up one level in this thread


On May 14, 1999 at 19:56:51, Eugene Nalimov wrote:

>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.

I figured out something similar on the way home.

2 bits for EP
00 no EP
01 right EP
10 left EP
11 both EP

plus if EP, then 3 more bits for column

and we save either 3 (or 4 in the case of both) of the starting squares or 9
bits there.

0 EP  2 bits
1 EP  5 bits
2 EP  8 bits

I am doing this quickly as I have to go, but I do not yet understand your entire
schmema yet ( I do not understand the 1xxxx yet ).

>
>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.

There is an additional savings here that I realized on my drive home. If there
is a 0xxxxxx case, then you split the board up into quadrants. If both kings are
in the same quandrant AND one of the kings is in the middle 4 squares of the
quandrant, than the other king only has 7 squares that it can be in (as opposed
to 16 if the other king is not in the same quandrant), so from one king, you can
occassionally save 1 bit on the other king. This means that there are 16 squares
on the board where the white king can be where the black king cannot if if is in
the same quadrant (unfortunately, a king on the edge of a quadrant only cuts out
5 of the 16 opposing king squares, otherwise, this could be even better).

KarinsDad :)


>
>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.