Skip to content

Conversation

@niklasf
Copy link
Member

@niklasf niklasf commented Mar 31, 2024

  • Information stored: Complete FEN (including move numbers, position not necessarily legal, invalid castling rights / ep may be lost) + variant

    Situation.AndFullMoveNumber <=> Array[Byte]
    
  • Relatively compact packing (but still further compressible with entropy coding). Examples:

    fen EpdFen SmallFen BinaryFen
    rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1 58 bytes 43 bytes 24 bytes
    QN4n1/6r1/3k4/8/b2K4/8/8/8 b - - 0 1 36 bytes 20 bytes 12 bytes
  • Main part of the encoding adapted from https://github.com/official-stockfish/nnue-pytorch/blob/master/lib/nnue_training_data_formats.h#L4607.

  • Move numbers not needed? The default of 0 1 is particularly efficient.

  • Quite fast:

    • order of 5 million reads / second
    • order of 3 million writes / second

@niklasf niklasf changed the title [WIP] Add reasonably compact binary representation for positions [WIP] BinaryFen Mar 31, 2024
@niklasf niklasf changed the title [WIP] BinaryFen Implement reasonably fast and compact BinaryFen Mar 31, 2024
@niklasf niklasf marked this pull request as ready for review March 31, 2024 21:30
niklasf and others added 4 commits April 1, 2024 15:41
Co-authored-by: Thanh Le <lenguyenthanh@hotmail.com>
Co-authored-by: Thanh Le <lenguyenthanh@hotmail.com>
@ornicar ornicar merged commit 44e880a into master Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants