A step-by-step simulation of encoding and decoding the same text using a dynamically-built dictionary.
Pease porridge hot, pease porridge cold,
Pease porridge in the pot, nine days old.
Some like it hot, some like it cold,
Some like it in the pot, nine days old.
Encoding Compress
Turns the 31-word rhyme into a short list of codes, building a dictionary of repeated phrases as it goes.
Step 0
Word sequence
Current phrase being tracked
-
Codes output so far
-
Dictionary (working memory — grows as repeated phrases are found)
Encoding finished. The only things that leave this step are the 13-word starting alphabet and the list of 23 codes. The full 34-entry dictionary above was scratch memory used to make decisions while encoding — it is not stored or transmitted anywhere.
Decoding Decompress
Starting from just the 13-word alphabet and the 23 codes, rebuilds the same dictionary independently and reconstructs the original rhyme.