Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Question about Bit storage

Author: Dann Corbit

Date: 10:58:20 01/29/02

Go up one level in this thread


On January 29, 2002 at 10:08:46, Robert Hyatt wrote:

>On January 28, 2002 at 19:41:07, Les Fernandez wrote:
>
>>On January 28, 2002 at 19:25:46, Vincent Diepeveen wrote:
>>
>>>On January 28, 2002 at 19:07:21, Les Fernandez wrote:
>>>
>>>>On January 28, 2002 at 19:01:26, Vincent Diepeveen wrote:
>>>>
>>>>>On January 28, 2002 at 18:54:07, Dann Corbit wrote:
>>>>>
>>>>>>On January 28, 2002 at 18:44:15, Vincent Diepeveen wrote:
>>>>>>
>>>>>>>On January 28, 2002 at 18:17:11, Dann Corbit wrote:
>>>>>>>
>>>>>>>that only shows how to store KRK as far as i see Dann,
>>>>>>>not a random position with nearly all pieces on the board.
>>>>>>>
>>>>>>>Not a single example of a full board position is inside the document.
>>>>>>>
>>>>>>>please encode next position for me, ignore castling rights doing it:
>>>>>>>
>>>>>>>nr3qrk/2QRp1Np/2p1Pp1n/2Pp3P/pp1P1K1P/3B1P2/PP1BNbp1/R7 w - - 0 1
>>>>>>
>>>>>>I assume that you can read his simple encoding system.  Now, take that method
>>>>>>and compose the position for it.  Then consider that that position (together
>>>>>>with its eval, ce, pv, etc) are identical to these, if you have read "Through
>>>>>>the Looking Glass":
>>>>>
>>>>>>7r/1PBnb1pp/2p1b3/p1k1p1PP/p3Pp2/N1Pp1P2/Pn1Prq2/KRQ3RN b - -
>>>>>>krq3rn/pN1pRQ2/n1pP1p2/P3pP2/P1K1P1pp/2P1B3/1pbNB1PP/7R w - -
>>>>>>nr3qrk/2QRp1Np/2p1Pp1n/2Pp3P/pp1P1K1P/3B1P2/PP1BNbp1/R7 w - -
>>>>>>r7/pp1bnBP1/3b1p2/PP1p1k1p/2pP3p/2P1pP1N/2qrP1nP/NR3QRK b - -
>>>>>
>>>>>>Since we encode 4 positions and need to store only 1 (the one that is lexically
>>>>>>smallest on top) we divide the number of bits needed by 4.  It is a trick so
>>>>>>simple that I am surprised anyone would not grasp the notion instantly.
>>>>>
>>>>>that reduces the thing by 2 bits. Somehow i get impression you guys
>>>>>confuse bits with bytes. You store positions in 162 bytes?
>>>>
>>>>Hi Vincent,
>>>>
>>>>No I think we are speaking of bits but my examples are representations of bits
>>>>but are actaully ascii at the moment but concept wise the same.  Hey check this
>>>>out!!
>>>>
>>>>1.4 bits/position  All positions have been extracted from a 63 bit binary key.
>>>>63/44= 1.4 bits/position. Thought you might enjoy this <S>
>>>
>>>your approach is worth nothing. because with my compression i get
>>>under 1 bit a position then.
>>>
>>>all you do is: "oh we need 250 bits to store a position, and we
>>>can mirror it 4 times ==> 250 / 4 = 60 bits a position needed".
>>>
>>>That is not funny of course.
>>>
>>>You need 250 bits in that case *not* 60 bits.
>>>
>>
>>Hello Vincent,
>>
>>I actually was not trying to be funny.  The novelty is the fact that variants
>>can be extracted from one position, not just mirrored images.  Therefore all you
>>need to have in your database one of these key positions and you get all the
>>rest for free.  Anyway from a storage point of view it could be of interest
>>since storage is becoming a concern as new egtb's are generated.  I played
>>around with 175,168 positions represented in binary (only 3 pieces KRk) and
>>after pkzip was used file size went from about 12MB down to about 700K.  Granted
>>this was a text file at the moment, not long integer, but the compression
>>reduction I expect to be very good due to the fact the file is made up of only
>>1's and 0's.
>>
>>Les
>>
>>
>>>
>
>OK.
>
>First you are saying that you have proven that there are no more than 2^81
>unique positions where neither side can castle...

No.  His notion is that if you mirror using every symmetry, the total number of
those positions (including ALL reflections) would be less than 2^81 in that
category.

>Second, you simply store the index into the ordered list of positions.

With all its associated data.

>But you totally ignore how you are going to turn that "index" into a real
>position?  Or how you are going to turn a real position into that index?

You take the position you are interested, and create all of its reflections (it
can be hundreds).  Then, you lexically sort them from smallest to largest using
memcmp.  Then, you look in the database for the smallest of those positions.
The same procedure will have been used to store the original entry into the
database.  Let's revisit the set that Les posted:

1R3K1k/8/8/8/8/8/8/8 w - - ce 32762; pv Ra8;
2R2K1k/8/8/8/8/8/8/8 w - - ce 32762; pv Ra8;
3R1K1k/8/8/8/8/8/8/8 w - - ce 32762; pv Ra8;
4RK1k/8/8/8/8/8/8/8 w - - ce 32762; pv Ra8;
5K1k/8/8/8/8/8/8/R7 w - - ce 32762; pv Ra8;
5K1k/8/8/8/8/8/R7/8 w - - ce 32762; pv Ra8;
5K1k/8/8/8/8/R7/8/8 w - - ce 32762; pv Ra8;
5K1k/8/8/8/R7/8/8/8 w - - ce 32762; pv Ra8;
5K1k/8/8/R7/8/8/8/8 w - - ce 32762; pv Ra8;
5K1k/8/R7/8/8/8/8/8 w - - ce 32762; pv Ra8;
5K1k/R7/8/8/8/8/8/8 w - - ce 32762; pv Ra8;
7r/8/8/8/8/8/8/K1k5 b - - ce 32762; pv Rh1;
8/7r/8/8/8/8/8/K1k5 b - - ce 32762; pv Rh1;
8/8/7r/8/8/8/8/K1k5 b - - ce 32762; pv Rh1;
8/8/8/7r/8/8/8/K1k5 b - - ce 32762; pv Rh1;
8/8/8/8/7r/8/8/K1k5 b - - ce 32762; pv Rh1;
8/8/8/8/8/7r/8/K1k5 b - - ce 32762; pv Rh1;
8/8/8/8/8/8/7r/K1k5 b - - ce 32762; pv Rh1;
8/8/8/8/8/8/8/1r3k1K b - - ce 32762; pv Ra1;
8/8/8/8/8/8/8/2r2k1K b - - ce 32762; pv Ra1;
8/8/8/8/8/8/8/3r1k1K b - - ce 32762; pv Ra1;
8/8/8/8/8/8/8/4rk1K b - - ce 32762; pv Ra1;
8/8/8/8/8/8/8/K1k1r3 b - - ce 32762; pv Rh1;
8/8/8/8/8/8/8/K1k2r2 b - - ce 32762; pv Rh1;
8/8/8/8/8/8/8/K1k3r1 b - - ce 32762; pv Rh1;
8/8/8/8/8/8/8/K1kr4 b - - ce 32762; pv Rh1;
8/8/8/8/8/8/r7/5k1K b - - ce 32762; pv Ra1;
8/8/8/8/8/r7/8/5k1K b - - ce 32762; pv Ra1;
8/8/8/8/r7/8/8/5k1K b - - ce 32762; pv Ra1;
8/8/8/r7/8/8/8/5k1K b - - ce 32762; pv Ra1;
8/8/r7/8/8/8/8/5k1K b - - ce 32762; pv Ra1;
8/r7/8/8/8/8/8/5k1K b - - ce 32762; pv Ra1;
k1K1R3/8/8/8/8/8/8/8 w - - ce 32762; pv Rh8;
k1K2R2/8/8/8/8/8/8/8 w - - ce 32762; pv Rh8;
k1K3R1/8/8/8/8/8/8/8 w - - ce 32762; pv Rh8;
k1K5/7R/8/8/8/8/8/8 w - - ce 32762; pv Rh8;
k1K5/8/7R/8/8/8/8/8 w - - ce 32762; pv Rh8;
k1K5/8/8/7R/8/8/8/8 w - - ce 32762; pv Rh8;
k1K5/8/8/8/7R/8/8/8 w - - ce 32762; pv Rh8;
k1K5/8/8/8/8/7R/8/8 w - - ce 32762; pv Rh8;
k1K5/8/8/8/8/8/7R/8 w - - ce 32762; pv Rh8;
k1K5/8/8/8/8/8/8/7R w - - ce 32762; pv Rh8;
k1KR4/8/8/8/8/8/8/8 w - - ce 32762; pv Rh8;
r7/8/8/8/8/8/8/5k1K b - - ce 32762; pv Ra1;

All of these positions are exact equivalents -- created by rotations,
reflections, etc.  (should be the pm instead of the pv, but that's neither here
nor there).  Anyway, all we need to do is store the first position:
1R3K1k/8/8/8/8/8/8/8 w - - ce 32762; pv Ra8;
And from that, we can generate all the others.  Using that position and its
associated information, we can quickly look up the solution to any of the other
problems.  We simply take the position we are given and perform the same
rotations and reflections (they are very simple, and the code to do it is posted
on my ftp site).  Then, pick the smallest one from that set and look into the
database and see if it is there.  If it is present, then we have a solution
move.

>It is computationally intractable in either direction...

Not only is it simple to calculate, he has a working version.

>
>>>
>>>>
>>>>k1K5/7R/8/8/8/8/8/8 w - - ce 32762; pv Rh8;
>>>>k1K5/8/7R/8/8/8/8/8 w - - ce 32762; pv Rh8;
>>>>k1K5/8/8/7R/8/8/8/8 w - - ce 32762; pv Rh8;
>>>>k1K5/8/8/8/7R/8/8/8 w - - ce 32762; pv Rh8;
>>>>k1K5/8/8/8/8/7R/8/8 w - - ce 32762; pv Rh8;
>>>>k1K5/8/8/8/8/8/7R/8 w - - ce 32762; pv Rh8;
>>>>k1K5/8/8/8/8/8/8/7R w - - ce 32762; pv Rh8;
>>>>k1K3R1/8/8/8/8/8/8/8 w - - ce 32762; pv Rh8;
>>>>k1K2R2/8/8/8/8/8/8/8 w - - ce 32762; pv Rh8;
>>>>k1K1R3/8/8/8/8/8/8/8 w - - ce 32762; pv Rh8;
>>>>k1KR4/8/8/8/8/8/8/8 w - - ce 32762; pv Rh8;
>>>>5K1k/R7/8/8/8/8/8/8 w - - ce 32762; pv Ra8;
>>>>5K1k/8/R7/8/8/8/8/8 w - - ce 32762; pv Ra8;
>>>>5K1k/8/8/R7/8/8/8/8 w - - ce 32762; pv Ra8;
>>>>5K1k/8/8/8/R7/8/8/8 w - - ce 32762; pv Ra8;
>>>>5K1k/8/8/8/8/R7/8/8 w - - ce 32762; pv Ra8;
>>>>5K1k/8/8/8/8/8/R7/8 w - - ce 32762; pv Ra8;
>>>>5K1k/8/8/8/8/8/8/R7 w - - ce 32762; pv Ra8;
>>>>1R3K1k/8/8/8/8/8/8/8 w - - ce 32762; pv Ra8;
>>>>2R2K1k/8/8/8/8/8/8/8 w - - ce 32762; pv Ra8;
>>>>3R1K1k/8/8/8/8/8/8/8 w - - ce 32762; pv Ra8;
>>>>4RK1k/8/8/8/8/8/8/8 w - - ce 32762; pv Ra8;
>>>>8/8/8/8/8/8/7r/K1k5 b - - ce 32762; pv Rh1;
>>>>8/8/8/8/8/7r/8/K1k5 b - - ce 32762; pv Rh1;
>>>>8/8/8/8/7r/8/8/K1k5 b - - ce 32762; pv Rh1;
>>>>8/8/8/7r/8/8/8/K1k5 b - - ce 32762; pv Rh1;
>>>>8/8/7r/8/8/8/8/K1k5 b - - ce 32762; pv Rh1;
>>>>8/7r/8/8/8/8/8/K1k5 b - - ce 32762; pv Rh1;
>>>>7r/8/8/8/8/8/8/K1k5 b - - ce 32762; pv Rh1;
>>>>8/8/8/8/8/8/8/K1k3r1 b - - ce 32762; pv Rh1;
>>>>8/8/8/8/8/8/8/K1k2r2 b - - ce 32762; pv Rh1;
>>>>8/8/8/8/8/8/8/K1k1r3 b - - ce 32762; pv Rh1;
>>>>8/8/8/8/8/8/8/K1kr4 b - - ce 32762; pv Rh1;
>>>>8/8/8/8/8/8/r7/5k1K b - - ce 32762; pv Ra1;
>>>>8/8/8/8/8/r7/8/5k1K b - - ce 32762; pv Ra1;
>>>>8/8/8/8/r7/8/8/5k1K b - - ce 32762; pv Ra1;
>>>>8/8/8/r7/8/8/8/5k1K b - - ce 32762; pv Ra1;
>>>>8/8/r7/8/8/8/8/5k1K b - - ce 32762; pv Ra1;
>>>>8/r7/8/8/8/8/8/5k1K b - - ce 32762; pv Ra1;
>>>>r7/8/8/8/8/8/8/5k1K b - - ce 32762; pv Ra1;
>>>>8/8/8/8/8/8/8/1r3k1K b - - ce 32762; pv Ra1;
>>>>8/8/8/8/8/8/8/2r2k1K b - - ce 32762; pv Ra1;
>>>>8/8/8/8/8/8/8/3r1k1K b - - ce 32762; pv Ra1;
>>>>8/8/8/8/8/8/8/4rk1K b - - ce 32762; pv Ra1;



This page took 0.01 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.