Earlier quoted context omitted.
To improve compression of a sorted list of words you can replace the (initial) letters repeated from the word above with spaces before compression and add them back as an extra step after decompression. For example, if the previous word was "apple", the next entry will be " y" ("apply", edit: HN removes extra spaces, so this should be four spaces + "y") ("apple" will probably already be entered as " le" (three spaces…
Because all the words are five letters here, you should be fine to elide leading spaces in this case.
Game Boy Wordle clone: How to compress 12972 five-letter words to 17871 bytes
101–110 of 170 posts
Re: Game Boy Wordle clone: How to compress 12972 five-letter words to 17871 bytes
#102I love little compression hacks like the one given in the article. I created a word search game way back in late 1978/early 1979 4KB of RAM. I had about 2KB for storing the word database. And I recall I had about 2,500 words. Which I had to type in by hand. I used the 26 tables of words trick too, to drop the first letter. I also treated each word being made up of 32 symbols. I called them letters, but they didn't re…
Man, at 11 my programs mainly consisted of INPUT, PRINT and GOTO, which I wrote on my uncle's brand new IBM XT.
Re: Game Boy Wordle clone: How to compress 12972 five-letter words to 17871 bytes
#103And far better than gzip compression. Nice work. My takeaway is that context matters - this is not General Purpose Compression, but compression made specifically for this case. Good Stuff.
To improve compression of a sorted list of words you can replace the (initial) letters repeated from the word above with spaces before compression and add them back as an extra step after decompression. For example, if the previous word was "apple", the next entry will be " y" ("apply", edit: HN removes extra spaces, so this should be four spaces + "y") ("apple" will probably already be entered as " le" (three spaces…
29.44% - Original sorted list just compressed with zstd
22.45% - Matching prefix characters from previous word replaced with space
19.38% - Matching prefix characters from previous word removed
Re: Game Boy Wordle clone: How to compress 12972 five-letter words to 17871 bytes
#104Re: Game Boy Wordle clone: How to compress 12972 five-letter words to 17871 bytes
#105You can get down to 15,559 bytes by combining a trie with Huffman coding: https://github.com/adamcw/wordle-trie-packing However, this doesn't beat general Brotli encoding of a ASCII trie representation, which gets down to 14,180 bytes (but needs an experience decoder), but goes to show general purpose compression is still really really good these days.
Re: Game Boy Wordle clone: How to compress 12972 five-letter words to 17871 bytes
#106> I don’t have a good feel for how fast the Game Boy runs, so I did a bit of speed optimization. This sounds like a very wrong approach to optimization. I mean, if you don't know exactly what and how to optimize, or if there's a need for optimization at all, then what are you doing?
I think OP was saying they weren't sure if the original algorithm would be too slow to run under these conditions, and didn't have the ability to test it at the time, so they wrote it in a way which increased the chances of it running quickly considering the system limitations.
Re: Game Boy Wordle clone: How to compress 12972 five-letter words to 17871 bytes
#107Re: Game Boy Wordle clone: How to compress 12972 five-letter words to 17871 bytes
#108Re: Game Boy Wordle clone: How to compress 12972 five-letter words to 17871 bytes
#109Re: Game Boy Wordle clone: How to compress 12972 five-letter words to 17871 bytes
#110My first thought would be “DAWG”. That’s a smart way to represent a trie, with identical ‘tail’ ends of the trie merged into one. https://www.cs.cmu.edu/afs/cs/academic/class/15451-s06/www/l... compresses a 780k word list into 175k. That’s about 22% of the size. This accomplishes 27%. This list is a lot shorter, so there will be fewer opportunities for savings. On the other hand, all words are five letters, so the ‘i…
> That’s a smart way to represent a trie, with identical ‘tail’ ends of the trie merged into one. That sounds like a DAG-shaped FSM to me...? At least I can't spot the difference.
I guess a strategy for compressing a word set could be to compile a regular expression recognizing it using a good regex engine and to then construct a compact representation of the resulting automaton.