Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Further Correction: This one is cool!

Author: Eugene Nalimov

Date: 15:33:35 05/14/99

Go up one level in this thread


If en-passant is possible, you can encode positions of 2 pawns into 14 different
values. Then you can store '0' at the corresponding squares of the board. Naive
encoding is:
000 (3 bits) - no EP possible,
xxxx (4 bits, not starting from 000) - one of the 14 possible configurations.
This way you use extra 1 bit on EP square, but save 2*2 bits on the board.

Eugene

On May 14, 1999 at 18:22:39, KarinsDad wrote:

>On May 14, 1999 at 18:13:10, Charles L. Williams wrote:
>
>>On May 14, 1999 at 18:11:04, Charles L. Williams wrote:
>>
>>>On May 14, 1999 at 17:10:38, KarinsDad wrote:
>>>
>>>>On May 14, 1999 at 15:21:57, Dann Corbit wrote:
>>>>
>>>>>0:
>>>>>Title says it all.  What binary format does your program use when you want to
>>>>>store a board position in the smallest space possible?
>>>>
>>>>Without thinking about it alot, here is my first cut (my program does not do
>>>>this yet):
>>>>
>>>>10 bits for side to move, en passant possible, en passant to square (4 bits
>>>>since there are only 16 legal squares for this), white kingside castle possible,
>>>>white queenside castle possible), black kingside castle possible, black
>>>>queenside castle possible (note: for a program, it may be better to know if a
>>>>rook moved and if the king moved, but you save 2 bits without that info here)
>>>>
>>>
>>>
>>>The en passant can be reduced to three bits because you already have the side to
>>>move.  The three bits represent the file.
>>>
>>>My program doesn't do any of this either.
>>>
>>>
>>>Chuck
>>>
>>>
>>><snipped>
>>
>>
>>Sorry, KarinsDad.  I just read your followup.  I think we may be posting here
>>nearly simultaneously.
>>
>>Chuck
>
>Yes, it looked that way.
>
>I have a further correction.
>
>Since pawns cannot exist on the 1st and 8th rank, we can minimize the structures
>there to:
>
>0 blank
>100x knight
>101x bishop
>110x rook
>111x queen
>
>This will save 1 bit for every minor piece on the 1st or 8th row.
>
>Slick, huh? This also allows the 1 bit savings on the en passant to be
>worthwhile and the starting position of the game can be represented in 157 bits
>or 20 bytes. Getting better all of the time!!!
>
>KarinsDad :)



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.