I disagree with that: the huge majority of positions will get a movelist inferior to 127 moves. So 7 bits is enough for this vast majority of situations. And handling the rare situations when you need more than 7 bits is easy: just use 255 (and 127) as an escape code: the next byte will contain the (nb_of_moves - 127) remaining moves. And if this number is, again, 255, then repeat. And if you code exactly for the 127th move then it would get coded 255 (or 127) and 0.bob wrote: Couple of points.
First, you need the full 8 bits for the index. There are positions with > 128 moves, which means 7 bits is not enough. The record is something like 230 legal moves.
Ten years ago, I programmed a compression program à la winzip, and I used escape codes a lot: they are very handy
That's what my compressor looked like, btw ^^
Bob, did you read this thread, or do you now jump over all of Ed's post?bob wrote: Second, for chess engines, I don't think anyone stores a book in the way you describe, nor have they for many years. Problem is that transpositions are difficult to detect. Most just store a huge file of zobrist hash signatures. If you make a move in any position, and can find the zobrist signature in the book file, you know that was a book move.
Anyway, I was just answering David's request, and this answer obviously helped him, so no need to jump on me. ^^Rebel wrote:Funny, mine is the same, still is, but added transpositions to it laterJuLieN wrote:Code: Select all
(e4(e5(Nf3(Nc6(Bb5 a6)Bc4)Nf6)f4)(c5 Nf3)(d6 d4)Nc6)e6)(d4(Nf6 c4(g6 Nc3)e6(Nc3 Bb4)Nf3)(d5(c4(c6 Nf3)(e6 Nc3)dxc4)Nf3)f5) etc.