Cover lesson · Expressive Arts · Year 4 · Intermediate
DCF: Data and computational thinking → Problem-solving and modelling
Name: Class: Date:
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.
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.
Add up the numbers in each row and write the total. Every row must make 12, because the grid is 12 squares wide.
| Row | Code | Total (must be 12) |
|---|---|---|
| 1 | 9W 2R 1W | |
| 2 | 8W 4R | |
| 3 | 8W 1R 1W 2R | |
| 4 | 3W 1R 3W 5R | |
| 5 | 2W 3R 1W 3R 3W | |
| 6 | 1R 1W 7R 3W | |
| 7 | 9R 3W | |
| 8 | 1W 7R 4W | |
| 9 | 2W 1R 4W 1R 4W | |
| 10 | 12G |
Follow the code row by row. Colour the squares. Leave white squares empty. Use a pencil dot first if you want to check.
| Colour | How 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?
Gruff copied rows 3, 5 and 8 but made a mistake in each one. A mistake in code is called a bug.
| Row | Gruff’s code | Total | Fixed code |
|---|---|---|---|
| 3 | 8W 1R 1W 2G | ||
| 5 | 2W 3R 1W 3R 4W | ||
| 8 | 1W 7R 3W |
Adding up found two bugs. Which bug did adding up not find? How did you find it?
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.
| Row | Loop | Number sentence |
|---|---|---|
| (a) | ||
| (b) | ||
| (c) | ||
| (d) Make up your own loop that fills a row of 12. |
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.
| Row | Code | Total |
|---|---|---|
| 1 | ||
| 2 | ||
| 3 | ||
| 4 | ||
| 5 | ||
| 6 |