Edmund wrote:diep wrote:Note that to store FENs, you can store chesspositions pretty compact.
A simple method is to use say for example:
64 bits : bitmap that basically says whether a piece is on a square or not
now we have for 32 pieces at most which can have 12 values, so with arithmetic encoding that's :
log 12 / log 2 = 3.58 bits
So for 32 pieces that's 114.7 = 115 bits.
So we have 147 bits for the position.
now let's store also its properties.
side to move is 1 bit , we are at 148 now.
we know we have at most 5 pawns we can capture en passant.
that's 2.32 bits.
That bad luck so far is that added up with the pieces that's 117.04 bits
so doesn't fit in 117 bits yet.
So we are at 151 now. Then for each side we must store 2 bits for castling rights of the rook at most.
So we end at 155 bits for a position.
Now Bob will probably post something about repetitions and stuff like that, but he isn't hashing that into crafty either and he is hashing en passant and castling rights, so 155 bits it is

Some comments:
you are missing the 7 bits needed for the 50-move counter; this counter can be combined with the ep squares because it has to be 0 in case of ep possibilities.
No we aren't missing that at all - is crafty hashing it?
You are missing out on some gains from restrictions due to chess rules. Pawns may occupy only 3/4 of the board, there is exactly one king per side, the kings may not be on neighboring squares and side to move may not give check.
There are some more, but the gains would probably not justify the efforts.
Yes it is possible to get a far more compact way of storing the position.
See some postings i did do on the pawns calculations some months/years ago in this forum.
You really can get the search space calculation down to 10^40 or less quite easily.
Using that scheme then to store will be far more efficient, yet that's not really his question if i understood well.
In fact if i look at what diep sees within its search space, knowing it'll search all nonsense as well, i notice that actually it never manages to promote more than 1 pawn simultaneously causing never to be more than 2 queens of 1 side on the board.
Sure it is possble and sure i bet some player one day tried to get 3 queens just to tease his opponent (something i'm never doing in chess - but i know there is some sadists out there).
Yet even the wildest search of Diep isn't showing this for game play.
So how many positions are there practical possible to achieve for within game play?
I don't know. Maybe 10^30? Maybe 10^35. You tell me.
There is more practical constraints for example. For example all 8 pieces aren't on the other side of the board usually.
So some sophisticated huffman+arithmetic encoding that you tune to the average case, if you go measure in the entire search during entire game, i bet you'll not gonna get over a 116 bits or so.
Vincent