Compression for Years 9–10: why it matters, run-length encoding (store how many of each colour in turn, and get back exactly the same picture), and lossy compression, which throws away what we won't notice, for good.
Each lesson works two ways. Students can work through the online tutorial at their own pace (it checks their answers and saves their progress in their browser), or you can teach it to the whole class from the slides, then send students into the tutorial for the Modify and Make steps.
Every lesson guide has plain-language notes, the answers to every check, a solution for every task, and slides and a worksheet for Waypoints Prepare. These guide pages are not linked from student pages, but they are not secret either: keep printed Teacher editions for answers you do not want students to find.
Whole-course cheat sheet: Open to print (every command, grouped by unit: a handout for the final challenge)
Run-length encoding, and when it is fine to throw data away (lossy and lossless).
Data is big: a phone photo is tens of millions of numbers. Compression stores the same data in fewer numbers, so it takes less space and less time to send.
Run-length encoding (RLE) stores runs: instead of white, white, white, black, black, black, black, white, store 3, 4, 1 (how many of each colour in turn). Decompressing gives back exactly the same picture, so RLE is lossless. It works well when data has long runs (icons, diagrams, faxes) and badly when every value differs (a checkerboard, a photo, noise), where it can even make data bigger.
Lossy compression throws away detail people are unlikely to notice: here, shades close to each other are treated as the same, so runs get longer. The data gets much smaller, but what is thrown away is gone for good. JPEG and MP3 are lossy; PNG and ZIP are lossless.
Choosing the wrong kind has consequences: a lossy medical scan, legal photo or spreadsheet could change what someone sees or decides. Streaming music and photos online is only practical because of lossy compression.
The pixel codes are CS Unplugged's Image representation activity (csunplugged.org, CC BY-SA 4.0).
compression, run-length encoding, lossless, lossy, compression ratio, tolerance.
Cheat sheet: Open to print (A4, with board pictures) · Markdown