- Solve compression code puzzles, simple puzzles about words that involve decoding compressed messages.
- Learn about data representation, compression, pattern matching and computational thinking.
Big files take a long time to transfer from one place to another. The more data the longer it takes, and the more memory is needed to store the information. We therefore compress files first, creating zip files for example to send. Data on computers is stored as long sequences of characters – ultimately as binary 1s and 0s. The idea with compression is that we use an algorithm to change the way the information is represented so that fewer characters are needed to store exactly the same information.
That involves using special codes. Each common word or phrase is replaced by a shorter sequence of symbols. A long file can be made much shorter if it has lots of similar sequences, just as the message below has been shortened. A second algorithm can then be used to get the original back. We’ve turned the idea into a puzzle. Can you work out what the original messages were?
Example
For example, given the message
32223111
With codebook:
1 [Da ]
2 [Do ]
3 [De ]
By repeatedly replacing 1s in the message with “Da ” from the codebook, 2 with “Do “ and 3 with “De “, we would recover the title of the 1980s Police song about abusing words:
De Do Do Do De Da Da Da
Try and solve the compression code puzzles below.
If you can program try writing a program (eg in Python) to solve puzzles like these.
Resources: Compression Code puzzles
Here are some Compression Code puzzle sheets and solutions that you can download:
- Puzzle Sheet: Compression Code Puzzle Sheet 1 [PDF]
- Solution Sheet: Compression Code Solution Sheet 1 [PDF]
A Christmas Carol
- Puzzle Sheet: Christmas Carol Compression Code Puzzle Sheet 1 [PDF]
- Solution Sheet: Christmas Carol Compression Code Solution Sheet 1 [PDF]
A Spanish Christmas Carol
- Puzzle Sheet: Spanish Christmas Carol Compression Code Puzzle Sheet 1 [PDF]
- Solution Sheet: Spanish Christmas Carol Compression Code Solution Sheet 1 [PDF]