in reply to Re: [OT] Is It Possible To Serialize A Chess Board In Fewer Than 23 Bytes?
in thread [OT] Is It Possible To Serialize A Chess Board In Fewer Than 23 Bytes?

I think you forgot promotion of pawns at the last rank

Maybe, maybe not. Either way, his approach correctly handles promotions.

As for you, it's not just promotions you don't handle. You don't support capturing either! You'd need a length prefix or more bits to encode that a piece is off the board.

  • Comment on Re^2: [OT] Is It Possible To Serialize A Chess Board In Fewer Than 23 Bytes?

Replies are listed 'Best First'.
Re^3: [OT] Is It Possible To Serialize A Chess Board In Fewer Than 23 Bytes?
by LanX (Saint) on Mar 11, 2026 at 00:53 UTC
    I thought about capturing but the "naive (sic) approach" got already long.

    > You'd need a length prefix or more bits to encode that a piece is off the board.

    Nope. Two pieces can't be on the same field and at least one king must be left. Just position a piece on the (remaining) king to encode capturing.

    This discussion is getting useless anyway, BC if the complexity of the task and fuzzy edge cases.

    I'd like to see a count of possible board combinations first.

    update

    IIRC you have also to encode if a match stops because of resignation or a draw or a stalemate...

    So many details.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    see Wikisyntax for the Monastery

      IIRC you have also to encode if a match stops because of resignation or a draw or a stalemate...

      As previously mentioned, if an end state is desired, a special value for the leading bitmap could be used.