Cover lesson · Mathematics and Numeracy · Year 3 · Beginner

Programming a litter-picking robot with compass directions

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

Also assessed, LNF: Numeracy → Geometry and measurement → Position

Name: Class: Date:

Cover teacher: you need no subject knowledge

What this practises: writing instructions for a robot (an algorithm) with compass directions, then predicting, fixing and shortening them. Pupils use N, E, S and W and position words such as next to and between to describe where things are on a map.

Print: this sheet, one per pupil. No computers are needed. Everything happens on the paper map. Pupils need a pencil and 2 or 3 coloured pencils.

Run: 5 min read “What you are doing” and the command card aloud · 7 min Step 1 · 7 min Step 2 · 12 min Step 3 · 7 min Step 4 · 8 min Step 5 · 9 min Step 6. Total 55 minutes. A useful tip to say aloud: north is always at the top of the map.

Collect: this sheet. Step 1 and the written route in Step 3 give the numeracy (position) evidence. Quick checks: in Step 2 Robi picks up the crisp packet and the bottle and ends between the pond and the swing. In Step 4 the wrong command is number 7: it should be E, not N. The worked example has every answer.

What you are doing

Robi, a small litter-picking robot on wheels with a grabber arm

This is Robi. Robi is a robot that picks up litter in Parc Glan yr Afon. The park and Robi are invented for practice.

Robi cannot think for itself. It only does exactly what the instructions say. A list of instructions for a robot is called an algorithm.

Today you will read, write, fix and shorten algorithms for Robi, using the compass directions north, east, south and west.

The command card

CommandWhat Robi does
↑ NMove 1 square north (up the map).
→ EMove 1 square east (right on the map).
↓ SMove 1 square south (down the map).
← WMove 1 square west (left on the map).
PPick up the litter on the square Robi is on.
repeat 3: EDo E 3 times. It means the same as E E E.

Robi’s rules

Map 1: Parc Glan yr Afon

Map 1. Map of Parc Glan yr Afon on a grid 8 squares wide and 6 squares tall, north at the top. The shed is in the bottom left corner. Trees are in the top left corner, the top right corner and 1 square in from the right edge on the 4th row. The pond fills 4 squares in the middle, near the top. The bench is south of the pond. The swing is in the 2nd row near the right. Litter: a sweet wrapper, a bottle, a can, a crisp packet and an apple core. Pond Tree Tree Tree Bench Swing Shed Sweet wrapper Bottle Can Crisp packet Apple core N 1 square =1 move Parc Glanyr Afon(invented)

Step 1: compass and position words

(a) Write N, E, S and W in the boxes. Tip: go round clockwise and say Never Eat Soggy Wheat.

A compass rose with 4 empty boxes to label

(b) Look at Map 1. Fill in the gaps. Use north, east, south, west, next to or between.

Sentence
1The pond is ______________ of the bench.
2The apple core is ______________ of the shed.
3The swing is ______________ of the bottle.
4The shed is ______________ of the crisp packet.
5The bottle is between the ______________ and the ______________.
6The sweet wrapper is next to a ______________.

(c) Write your own sentence about the map. Use a compass direction or a position word.

Step 2: predict, then trace

Here is an algorithm for Robi. Robi starts on the shed.

Command1234567891011
Robi does→ E→ E→ E→ E→ EP↑ N↑ N↑ N↑ NP

(a) Predict. Do not draw yet. Look at the commands. Which litter do you think Robi will pick up?

(b) Trace. Now put your finger on the shed on Map 1. Follow one command at a time. Draw Robi’s route on Map 1 in one colour.

(c) Robi picked up the ______________ and the ______________.

(d) Robi ends between the ______________ and the ______________.

(e) Was your prediction right? ______________

Step 3: write your own algorithm

Robi must pick up the can, the sweet wrapper and the crisp packet, in any order. Then Robi must go back to the shed.

(a) Plan your route on Map 2 in pencil. Remember Robi’s rules.

Map 2: plan your route here

Map 2, a second copy for planning a route. Map of Parc Glan yr Afon on a grid 8 squares wide and 6 squares tall, north at the top. The shed is in the bottom left corner. Trees are in the top left corner, the top right corner and 1 square in from the right edge on the 4th row. The pond fills 4 squares in the middle, near the top. The bench is south of the pond. The swing is in the 2nd row near the right. Litter: a sweet wrapper, a bottle, a can, a crisp packet and an apple core. Pond Tree Tree Tree Bench Swing Shed Sweet wrapper Bottle Can Crisp packet Apple core N 1 square =1 move Parc Glanyr Afon(invented)

(b) Write your algorithm, one command in each box. Use N, E, S, W and P.

(c) Now write the same route in words, like this: 4 squares north, then 1 square east, then pick up the …

(d) Test it. Follow your algorithm on Map 2 with your finger. Does Robi pick up all 3 and get back to the shed? ______________

Step 4: fix Ffion’s algorithm

Ffion wants Robi to pick up the can, then the bottle. She wrote this algorithm, but 1 command is wrong.

Command1234567891011
Robi does↑ N↑ N→ E→ EP→ E↑ N→ E↑ N↑ NP

(a) Trace Ffion’s algorithm on Map 1 in a new colour. What goes wrong?

(b) Which command number is wrong? ________ What should it be? ________

(c) Trace your fixed algorithm. Does Robi pick up the can and the bottle now? ________

Step 5: make it shorter with repeat

When the same command comes again and again, you can use repeat. E E E can be written as repeat 3: E.

Long algorithmShorter algorithm using repeat
(a) The Step 2 algorithm:
E E E E E P N N N N P
(b) Aled starts Robi on the apple core:
W W W W W W W
(c) Seren’s algorithm:
N N N N E N P

(d) In (a), how many commands were there before? ________ How many lines did you write with repeat? ________

(e) Where does Aled’s algorithm take Robi? ________________ Which litter does Seren’s algorithm pick up? ________________

(f) Find a repeat in your own algorithm from Step 3. Write that part again using repeat.

Step 6: change the algorithm

Here is the Step 2 algorithm written with repeat:

repeat 5: E P repeat 4: N P

(a) Change one number so Robi picks up the apple core instead of the crisp packet. Write the new algorithm.

(b) Where does Robi end now? Use a compass direction or a position word. Does the last P pick anything up?

(c) Go back to the first algorithm (repeat 5: E). Robi ends on the bottle. Add commands to the end so Robi goes back to the shed.

(d) Your choice. Change the algorithm so Robi ends somewhere new. Write it, then say where Robi ends.

Step by step

  1. 5 min Read “What you are doing”, the command card and Robi’s rules. Find the shed on Map 1.
  2. 7 min Step 1: label the compass and fill in the sentences.
  3. 7 min Step 2: predict first, then trace one command at a time.
  4. 12 min Step 3: plan on Map 2, write the commands, then write the route in words.
  5. 7 min Step 4: trace Ffion’s algorithm, find the mistake and fix it.
  6. 8 min Step 5: shorten the algorithms with repeat.
  7. 9 min Step 6: change the algorithm to get a new ending.

Success criteria

If you finish early