← ACARA Digital Technologies Years 5–6

Decoding run-length counts back into pixels

Turn counts back into pixels: write that many of one colour, then that many of the other, taking turns, until the row is full. Start with white. A first count of 0 means the row starts black.

Understanding Decoding run-length counts back into pixels in ACARA Digital Technologies Years 5–6

What it does: The first count is white, the next is black, the next is white again, so the counts 2,3,1 decode to WWBBBW. You always start with white. Write 3 white pixels, then 2 black pixels. The colours take turns: white, black, white, black, and so on. 3 + 2 + 2 = 7. The counts must add up to the grid width, so something is wrong. After decoding, add the counts. If the total equals the row width, the row is full and correct.

Common mistakes: Decoding takes turns between colours. After 3 white comes black, so line 3 should be '2 black: BB'. Decoding always starts with white. Only a first count of 0 means the row starts black. Here the first count is 2, so start with white.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 59–71) and word search (Modules 44–71).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
A row is 5 pixels wide and its counts are 3, 2. Which row do you get? (W = white, B = black)
WWWBBBBBWW
Matches
Counts 2,3,1 on a 6-wide row decoded as BBWWWB
↓
The row was started with black. The first count is always white unless it is 0. It should be WWBBBW.
Applying
Meanings
Term
run-length decoding
Meaning
Turn counts back into pixels: write that many of one colour, then that many of the other, taking turns, until the row is full. Start with white. A first count of 0 means the row starts black.
Practice
Counts: 3 2 4
Testing
Gaps
Counts 3, 2, 1 -> BBW
Check Answer
Spots
23 white: WWW
32 white: WW

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Kraken' badge — Deep Sea Master, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. A row is 5 pixels wide and its counts are 3, 2. Which row do you get? (W = white, B = black)
A. BBBWW
B. WWWBB ✓
You always start with white. Write 3 white pixels, then 2 black pixels.
2. A row is 6 pixels wide and its counts are 0, 4, 2. Which row do you get?
A. BBBBWW ✓
B. WWWWBB
The first count is 0, so you write 0 white pixels. That means the row starts black: 4 black, then 2 white.
3. What does a first count of 0 tell you when decoding?
A. The row is empty
B. The row starts with black ✓
You start with white, but 0 white pixels means none are written. The first pixels are black.
4. You have just written the pixels for one count. What do you do for the next count?
A. Switch to the other colour ✓
B. Keep using the same colour
The colours take turns: white, black, white, black, and so on.
5. A grid is 8 pixels wide. A row has the counts 3, 2, 2. Does this row add up?
A. No, it adds up to 7, so 1 pixel is missing ✓
B. Yes, it adds up to 8
3 + 2 + 2 = 7. The counts must add up to the grid width, so something is wrong.

Match the Pairs

3,2,3 (8 wide) → Decodes to WWWBBWWW: 3 white, then 2 black, then 3 white
4 + 2 + 2 = 8 → A check that the counts add up to the grid width of 8 pixels
Start with white, then take turns between colours: 2 white, 3 black, 1 white → 2,3,1 = WWBBBW
A row that starts with black has a first count of 0 white pixels → 0,3,3 = BBBWWW
Counts 2,3,1 on a 6-wide row decoded as BBWWWB → The row was started with black. The first count is always white unless it is 0. It should be WWBBBW.
Counts 3,2,3 on an 8-wide row decoded as WWWBBWW → Only 2 white pixels were written at the end instead of 3, so the row has 7 pixels, not 8. It should be WWWBBWWW.

Key Term

run-length decoding
Turn counts back into pixels: write that many of one colour, then that many of the other, taking turns, until the row is full. Start with white. A first count of 0 means the row starts black.

Fill in the Blanks

1. Counts 3, 2, 1 -> WWWBBW
Hint: Decoding starts with white, so type the first run: as many white pixels as the first count says.
2. Counts 0, 2, 3 -> BBWWW
Hint: The first count is 0, so no white pixels come first. Type the black run that follows.
3. Counts 4, 3, 1: 4 + 3 + 1 = 8 pixels
Hint: Add the counts to find the grid width. Type the total.
4. Width 6, counts 5, 1 add up to 6
Hint: Type the missing last count that makes the counts fill the whole row width.
5. W = white, B = black Counts 2, 1, 2 -> WWBWW
Hint: Colours take turns. Type the letter for the colour that comes after the first white run.

Spot the Error

Question 1
A Counts: 3, 2, 3 (width 8)
B 3 white: WWW
C 2 white: WW
D 3 white: WWW
E Row: WWWBBWWW
Line C — Decoding takes turns between colours. After 3 white comes black, so line 3 should be '2 black: BB'.
Question 2
A Start with black
B Counts: 2, 4, 2
C WW BBBB WW
D Total: 2+4+2 = 8 pixels
Line A — Decoding always starts with white. Only a first count of 0 means the row starts black. Here the first count is 2, so start with white.
Question 3
A Counts: 0, 3, 4
B 0 white: (none)
C 3 white: WWW
D 4 white: WWWW
E Row: BBBWWWW (width 7)
Line C — The first count 0 means no white pixels, so the colours take turns and the next 3 pixels are black. Line 3 should be '3 black: BBB'.
Question 4
A Width: 6
B Counts: 0, 2, 3
C Row: BBWWW
D Check: 0+2+3 = 5
Line A — The counts 0+2+3 add up to 5, and the decoded row has 5 pixels. So the width must be 5, not 6.
Question 5
A Counts: 4, 1, 3
B Row: WWWBWWWW
C Check: 4+1+3 = 8
D Width: 8 pixels
Line B — The counts say 4 white, 1 black, then 3 white. The broken row has 3 white, 1 black, then 4 white. It should be WWWWBWWW.

Student with a class code? Join your class →