Skip to content

Dictionary File Formats

Freddie Mercurial edited this page Feb 7, 2022 · 1 revision

The WordMasterMind engine can load dictionaries in three formats:

  • A Text (.txt or no extension) file with one word per line (alphabetical only, no special characters, spaces, etc).
  • A JSON (.json) file composed simply as an array of strings- newlines and trailing commas accepted. eg: [ "A", "B", ... ]
  • A Binary (.bin) internal serialized format (see: LiteralDictionary.Serializer) which contains groupings of words organized by word length.
    • the format will not be described as the code is the best place to go and describes itself, however you should not need to be editing or creating these by hand.
    • src/WordMasterMind.Utilities/ has a utility to convert Text or Json formats to the more optimized binary format.
      • The binary format saves on load time as it has the words pre-sorted by length.
      • The binary format also supports and encourages splitting the data into separate files for each word length, as the UI has to load more words than necessary otherwise and significantly impacts the load time.
      • Examples:
        • text to binary:
          cd /src/WordMasterMind.Utilities
          bin/Debug/net6.0/WordMasterMind.Utilities.exe binary ~/trekle-words.txt ./trekle-words.bin
          
        • binary to split-binary:
          cd /src/WordMasterMind.Utilities
          bin/Debug/net6.0/WordMasterMind.Utilities.exe ./trekle-words.bin ./trekle-words.bin
          
          • This will produce a one file for each word length in the file, of the format #-trekle-words.bin and one additional trekle-words.bin-lengths.json which will have a simple integer array of the available word-lengths in that dictionary (used for the length selection screen).
          • once the #-title.bin and the #-title.bin-lenghts.json files have been produced, you can set aside the original title.bin file and only copy the new files to the src/WordMasterMind.Blazor/wwwroot/dictionaries folder
Clone this wiki locally