Cover lesson · Expressive Arts · Year 4 · Intermediate

Coding a pixel art Welsh dragon

DCF: Data and computational thinking → Problem-solving and modelling

Name: Class: Date:

Cover teacher: you need no subject knowledge

What this practises: following and writing a code that a computer could use to draw a picture, finding and fixing bugs, and using repeat loops to shorten instructions. Digital artists build pictures from tiny squares called pixels. Every row of the grid is 12 squares wide, so every row of code must add up to 12. Pupils add the rows, count the colours and check the grand total, so the number work is real numeracy and is marked from the sheet.

Print: this sheet, one per pupil. Pupils need red and green coloured pencils and a pencil. No computers are needed.

Run: 5 min read “How pixel code works” together and do row 1 as a class · 6 min Step 1 · 12 min Step 2 · 8 min Step 3 · 10 min Step 4 · 8 min Step 5 · 10 min Step 6. Total 59 minutes.

Collect: this sheet. The numeracy evidence is Step 1 (row totals), Step 3 (colour counts and the check) and Step 5 (loop number sentences). Quick checks: every row makes 12; red 47, white 61, green 12, total 120 = 12 × 10; Gruff’s bugs are in rows 3, 5 and 8.

How pixel code works

A computer screen is made of tiny squares called pixels. A code tells the computer what colour each square should be. Read each row from left to right. 9W means colour 9 squares white. 2R means colour 2 squares red.

W = whiteR = redG = green

Step 1: check the code

Add up the numbers in each row and write the total. Every row must make 12, because the grid is 12 squares wide.

RowCodeTotal (must be 12)
19W 2R 1W
28W 4R
38W 1R 1W 2R
43W 1R 3W 5R
52W 3R 1W 3R 3W
61R 1W 7R 3W
79R 3W
81W 7R 4W
92W 1R 4W 1R 4W
1012G

Step 2: run the code

Follow the code row by row. Colour the squares. Leave white squares empty. Use a pencil dot first if you want to check.

12345678910

Step 3: count the pixels

ColourHow many squares?How I worked it out
Red
White
Green
All squares

Check: the grid has 10 rows of 12. Write the multiplication: ____ × ____ = ____. Does it match your total for all squares?

Step 4: bug hunt

Gruff copied rows 3, 5 and 8 but made a mistake in each one. A mistake in code is called a bug.

RowGruff’s codeTotalFixed code
38W 1R 1W 2G
52W 3R 1W 3R 4W
81W 7R 3W

Adding up found two bugs. Which bug did adding up not find? How did you find it?

Step 5: use a loop

Row 10 is 12G. That is much shorter than writing G twelve times. A loop repeats a part of the code. For example repeat 4 times [2R 1W] makes RRW RRW RRW RRW, and 4 × 3 = 12.

Write a loop for each row, then a number sentence to show it makes 12.

RowLoopNumber sentence
(a)
(b)
(c)
(d) Make up your own loop that fills a row of 12.

Step 6: your own pixel art

Design a picture on this 12 by 6 grid, for example a daffodil, a love spoon or a harp. Write the code for each row. Check every row makes 12. Then swap codes with a partner and see if they can draw your picture.

123456
RowCodeTotal
1
2
3
4
5
6

Step by step

  1. 5 min Learn how pixel code works with your teacher.
  2. 6 min Step 1: add up each row.
  3. 12 min Step 2: colour the dragon.
  4. 8 min Step 3: count the pixels and check.
  5. 10 min Step 4: find and fix Gruff’s bugs.
  6. 8 min Step 5: write loops.
  7. 10 min Step 6: design and code your own picture.

Success criteria

If you finish early