Shortest possible encoding of a chessboard?

There are cases when you’d need more than 2 for pawns, if you’re counting promotions as distinct pawn moves. With a white pawn on b7, and black pieces on a8 & c8, the pawn has 12 different moves.

I figured this was just an intellectual exersize. Even with a bad dialup connection, the difference between the best and worst algorithm we’ve discussed in this thread is an extra hundredth of a second to transmit the whole board. On a decent broadband connection, we’re talking about a couple hundred microseconds.

Ah, but what the OP didn’t tell you is that he wishes to encode the state of the entire chessboard . . . down to the atomic level.

You may assume the pieces are made of cheap hollow plastic, and not marble let’s say, for better compression. You may also ignore air molecules. But don’t forget to include the “castling” and “en-passant” flags in your state representation somewhere. You’ll feel foolish if you successfully transmit all those atom states, but overlook the last few bits critical to play.

Also, you may assume a 64-bit address space to work with, for a nice big sliding window. Watch out for VM swapping though. Try to take advantage of locality for good cache performance. Justify your trade-offs and choic of data structure.

(Hmm, after re-reading, it seems the OP asked for no such thing after all. I could have sworn otherwise.)

Silly me. At first, I thought solid plastic would be better. I put a bunch of solid pieces and a bunch of hollow pieces in the trash compacter, though, and found that the hollow ones do, indeed, provide better compression.

I found the best way to represent the castling flag was with a real flag. It settles into a hole in the top of each rook, and is removed as soon as that rook may no longer castle.