Different board representations in computer chess
lichess.org
lichess.org
Bitboards themselves make efficient board serialisation of chess possible and somewhat portable, making it amenable to modern AI tooling. An interest area of mine is to work towards similar representations for other games, especially modern Eurogames.
I will be PM with some thoughts and hope to hear from you.
With bitboards: There are 12 types of pieces, so could use 4 bitboards[0] to capture all of the information. 64 * 4 = 256 bits.
I think the most compact would be a combination. One bitboard (64 bits) marking where pieces are, and then a list of 4 bit integers[0] noting which piece is which, ordered by how they show up on the bitboard. With 32 pieces that's an additional 128 bits, for 192 total. And the size could only go down from there, as pieces are removed.
Writing this out, I see how 4 bitboards would be much simpler than 1 bitboard and a weirdly-indexed list that needs to be reordered every move.
[0] Boards could be 1=white/0=black, 1=more/0=less than 4 points, 1=royal-or-minor/0=rook-or-pawn, 1=queen-bishop-rook-or-pawn/0=king-knight-or-nothing, so that all 0s means no piece, and 1000, 0100, and 1100 as unused values. The full list would be:
0000 - empty
0001 - black pawn
0010 - black knight
0011 - black bishop
0100 - reserved
0101 - black rook
0110 - black king
0111 - black queen
1000 - reserved
1001 - white pawn
1010 - white knight
1011 - white bishop
1100 - reserved
1101 - white rook
1110 - white king
1111 - white queenYou would also have to store the last move made by a side to determine if en passant is legal, if the kings can castle, as well as which side is to move. Reserved values could be used for this as well as flags for other things to improve compression.
And maybe there's a way to reduce that even more, by allowing different ways of reading through the board, and trying to use that to order the pieces so that we can use less bits for encoding them. For example, if the board starts with 0 it's a regular pattern of doing line A, 1 to 8, then line B, etc, but if it starts with 1 we read it as a spiral, so A1 to A8 to H8 to H1 to B2. And maybe this way we can at least find a place where two of the same pieces are following each other and we can organize everything so that for each piece that is the same as the one before we can only use a single bit at 1.
You can probably go much deeper than that, but it's already a fun start.
Bonus points: Ask it to invent Fairy Chess deviant moves [https://en.wikipedia.org/wiki/Fairy_chess]