Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: How do you internally store binary board positions in the minimum space?

Author: Dann Corbit

Date: 18:46:32 05/14/99

Go up one level in this thread


On May 14, 1999 at 21:11:58, Christophe Theron 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?
>>
>>1:
>>Is anyone willing to provide source for a EPD to Binary converter that operates
>>in both directions?
>>
>>2:
>>What are the tradeoffs between the smallest size that you can crush a position
>>into and the fastest binary format that you can create?
>
>I would be interested in such coding/decoding routines too. Speed is not really
>an issue I think.
>
>I would add to the desired features that the encoded position should always take
>the same space.
>
>Why? I currently use such an encoding to store positions in my opening book (I
>don't want to rely on hash codes, as a hash code cannot be converted back to a
>position). Variable length encoding is of no interest in this case.
>
>Being able to extract positions from my book has several purposes, one of it is
>to be able to edit it without knowing the move sequence that lead to a position.
>
>Without working too much on it I have found a simple way to encode positions on
>32 bytes for any possible (legal) position. I read somewhere else in the thread
>that a near 20 bytes encoding is possible. That would be nice, so guys keep on
>thinking about it... But you should also think about the worst case. It doesn't
>help much to be able to crush a position into 10 bits if the algorithm in the
>worst case needs 320 bits...
Another source for ideas would be Peter Klausler's descriptions on how he stores
positions in CDB.  I would prefer (if possible) a single format instead of
several different ones.  Variant records, unions, and common blocks can be messy
to deal with.  In C++ we could make objects but that would restrict some users
of the tools.

I think it might be nice to produce:
0.  A formal specification for a portable binary compact chess board position.
I have seen some discussion about a binary version of EPD, but I have never seen
a formal specification.  Perhaps what I am looking for already exists.

1.  Sample code that can both encode and decode these positions.  It would be
nice if it could be made available in many languages, including C, C++, Pascal,
BASIC, etc.  Having at least C, we could write DLL's so that any PC client could
use it regardless of language.

Having this, we can write portable interfaces to other systems.  I want to write
an interface to the C.A.P. data so that chess programs can have access.
However, if I am going to hold a million positions in memory, I don't want to
waste space unnecessariy, nor have a 10,000 line function call to encode or
decode.  Most of all, I want a clear description of the model.  Hopefully, the
format can be simple and the space very compact.



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.