user3405: What is the most compressed way to "write" a chessboard as an integer considering en passant and castling as always possible no matter what.

user956: If all the pieces are on the board, there are 64!/32!/8!^2/2^6*(32/63)*(31/61) or about 1.2*10^42 positions.  This would require 140 bits.  The 64!/32! puts the pieces on squares, the divisions account for permuting like pieces, and the last two fractions put the bishop pairs on opposite color squares.  I would guess a dozen or so more bits would be required to cover positions with some of the pieces gone, but calculating the exact number is not so easy.  Decoding a position from 140 bits can be done, but would be a pain.  Clearly 8 bytes will not suffice.

3405: <p>What is the most compressed way to "write" a chessboard as an integer considering en passant and castling as always possible no matter what.</p>
 956: <p>If all the pieces are on the board, there are 64!/32!/8!^2/2^6*(32/63)*(31/61) or about 1.2*10^42 positions.  This would require 140 bits.  The 64!/32! puts the pieces on squares, the divisions account for permuting like pieces, and the last two fractions put the bishop pairs on opposite color squares.  I would guess a dozen or so more bits would be required to cover positions with some of the pieces gone, but calculating the exact number is not so easy.  Decoding a position from 140 bits can be done, but would be a pain.  Clearly 8 bytes will not suffice.</p>
