Earlier quoted context omitted.
Yes 9 bits is 2 bytes. The article confusingly says 18 bits = ~2 bytes. It is the "about 2 bytes" that is confusing. They probably mean that an extra bit won't matter too much since we are bit packing the games in a contiguous stream. BUT In the article they don't mean that 00000034 is a bit or a byte. It is one of the possibilities and there are 495 of them and if you index each possibly in a 2 byte integer, you can…
You understand me, this is most important. And thank you for explaining this exercise - but to be honest, if the article says "How to store a chess position in 26 bytes" And you actually cannot store this in 26 bytes based on your implementation, and then you show integer bits and bytes that aren't even binary...eh. And to be honest, like how about we store the chess position in 1 bit. I will execute some chess posit…
How to store a chess position in 26 bytes (2022)
91–100 of 108 posts
Re: How to store a chess position in 26 bytes (2022)
#92Re: How to store a chess position in 26 bytes (2022)
#93what's wrong with scrolling on that blog? arrow keys don't work
Re: How to store a chess position in 26 bytes (2022)
#94I remember asking myself this question years ago, and came to 162 bits. I was just a kid back then so the logic is probably wrong but I do wonder how simple the encoding could be under those constraints... Edit: Here are the Notes 0 Empty 10 Pawn 1100 Knight 1101 Rook 1110 Bishop 1111 Queen 32 + 32 + 4 7 2 2 times 6 bits: position of the kings 30 bits: color mask 120 + 2*6 + 30 = 162 bits We can store the rest using…
Considering at least half of all squares are empty, further compression is in order for the empty space. Also if you're encoding the king as a position instead of a byte sequence you would have to encode their space as empty, that's an extra 2 bits
Re: How to store a chess position in 26 bytes (2022)
#95I remember asking myself this question years ago, and came to 162 bits. I was just a kid back then so the logic is probably wrong but I do wonder how simple the encoding could be under those constraints... Edit: Here are the Notes 0 Empty 10 Pawn 1100 Knight 1101 Rook 1110 Bishop 1111 Queen 32 + 32 + 4 7 2 2 times 6 bits: position of the kings 30 bits: color mask 120 + 2*6 + 30 = 162 bits We can store the rest using…
In the case of (b) there are now fewer pawns that can be promoted, and so worst case, we have to pay a budget of 1 bit per each of 8 promoted pawns.
So I think maximum required bits is only 162 + 8 = 170?
Re: How to store a chess position in 26 bytes (2022)
#96I remember asking myself this question years ago, and came to 162 bits. I was just a kid back then so the logic is probably wrong but I do wonder how simple the encoding could be under those constraints... Edit: Here are the Notes 0 Empty 10 Pawn 1100 Knight 1101 Rook 1110 Bishop 1111 Queen 32 + 32 + 4 7 2 2 times 6 bits: position of the kings 30 bits: color mask 120 + 2*6 + 30 = 162 bits We can store the rest using…
Considering at least half of all squares are empty, further compression is in order for the empty space. Also if you're encoding the king as a position instead of a byte sequence you would have to encode their space as empty, that's an extra 2 bits
Re: How to store a chess position in 26 bytes (2022)
#97I remember asking myself this question years ago, and came to 162 bits. I was just a kid back then so the logic is probably wrong but I do wonder how simple the encoding could be under those constraints... Edit: Here are the Notes 0 Empty 10 Pawn 1100 Knight 1101 Rook 1110 Bishop 1111 Queen 32 + 32 + 4 7 2 2 times 6 bits: position of the kings 30 bits: color mask 120 + 2*6 + 30 = 162 bits We can store the rest using…
Each pawn that wants to be promoted either takes: (a) another 'special' piece (knight/rook/bishop/queen), in which case it has already bought enough bit budget to later be promoted; or (b) another pawn, in which case this temporarily saves 1 bit (as the other pawn becomes a space), but then later we need 2 extra bits for the promotion, so we pay 1 bit extra per pawn in total In the case of (b) there are now fewer paw…
Re: How to store a chess position in 26 bytes (2022)
#98Re: How to store a chess position in 26 bytes (2022)
#99> Since each position takes up 6 bits ($2^6 = 64$), multiplying 6 bits by 32 pieces gives us 192 bits / 24 bytes (1 byte = 8 bits). But each position can only be used once, so you really only have 64*63*62*61*...*33 possibilities = 64!/32! = ~2^53, so you could encode this with less than 7 bytes, and then use the basic 12-byte encoding for captures, castling, en-passant, and promotions, and you are below 19 bytes in…
Multiplying 32 numbers each over 5 bits long obviously results in more than 160 bits. 64!/32! > 2^178.3
Re: How to store a chess position in 26 bytes (2022)
#100Earlier quoted context omitted.
Each pawn that wants to be promoted either takes: (a) another 'special' piece (knight/rook/bishop/queen), in which case it has already bought enough bit budget to later be promoted; or (b) another pawn, in which case this temporarily saves 1 bit (as the other pawn becomes a space), but then later we need 2 extra bits for the promotion, so we pay 1 bit extra per pawn in total In the case of (b) there are now fewer paw…
Among 4 pawns like white and black a&b pawns, you only need 1 pawn capture to allow the other 3 pawns to promote.
I'm trying to prove that is the worst case, but there are just too many cases. I guess I'll try to use a program o brute force it or just forget about it.