A playful primer on coding theory frames the problem as two neighbors trying to communicate at night with flashlights and uses that scenario to introduce core concepts: messages, symbols, codewords, encoding and decoding. It walks through simple schemes - drawing letters with light, then a unary scheme mapping A-Z to 1-26 blinks - and shows the inefficiency and ambiguity that arise without clear separators. Introducing letter-frequency optimization (the core idea behind variable-length coding), the primer demonstrates that assigning shorter codewords to common letters reduces expected transmission length, cutting an example message from 206 blinks to 138 (about 33% fewer blinks).
The primer then presents Morse code as a two-symbol (dot and dash) variable-length system, explains the timing rules (dash = three dots) and the decoding tree that makes Morse uniquely decodable, and gives a worked encoding of "I LOVE CODING THEORY" reduced to 91 blinks (another ~33% saving). It highlights punctuation concerns (pauses between elements, letters, words), notes how code design already considered letter frequency, and points toward limitations and decoding challenges that follow from different coding choices, setting up deeper discussions of efficient and error-robust codes.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.