Worked example · Mathematics and Numeracy · Year 3

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

What this is

A secure Year 3 response, annotated so you can see which success criterion each part meets. It is also the answer key. Key answers: Step 2 Robi picks up the crisp packet and the bottle and ends between the pond and the swing. Step 3 has many correct routes; the shortest take 20 moves. Step 4: command 7 should be E, not N (as written, Robi drives into the pond). Step 6 (a): repeat 7: E, and Robi ends east of the swing.

Step 1: compass and position words

A compass rose labelled N at the top, E on the right, S at the bottom and W on the left NESW
Sentence
1The pond is north of the bench.
2The apple core is east of the shed.
3The swing is east of the bottle.
4The shed is west of the crisp packet.
5The bottle is between the pond and the swing.
6The sweet wrapper is next to a tree.

(c) The bottle is north of the crisp packet. The crisp packet is between the shed and the apple core.

N, E, S and W are in the right places, going clockwise. Each sentence uses a compass direction or a position word correctly. Accept other true sentences in (c). Evidences criteria 1 and 2.

Step 2: predict, then trace

(a) I think Robi goes east along the bottom and picks up the crisp packet. Then it goes north. I think it picks up the bottle.

(c) Robi picked up the crisp packet and the bottle.

(d) Robi ends between the pond and the swing.

(e) Yes, my prediction was right.

The pupil predicts before tracing, then checks one command at a time. Robi moves 5 squares east and 4 squares north (9 moves). Evidences criterion 3.

Step 3: write your own algorithm

This model route picks up the sweet wrapper, then the can, then the crisp packet. The dashed line is the way home.

Model route for Step 3 drawn on the map. Robi goes north from the shed to the sweet wrapper, south to the can, east and south to the crisp packet, then west along the bottom back to the shed. 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)
12345678910
NNNNENPESS
11121314151617181920
SPEESSEPWW
212223
WWW

(c) 4 squares north, then 1 square east, then 1 square north. Pick up the sweet wrapper. 1 square east, then 3 squares south. Pick up the can. 2 squares east, then 2 squares south, then 1 square east. Pick up the crisp packet. 5 squares west, back to the shed.

(d) Yes. I tested it with my finger and Robi picks up all 3 and gets back to the shed.

The symbols and the words describe the same route, and every move uses a compass direction and a number of squares. Robi never touches the pond, the trees, the bench or the swing. That is 20 moves and 3 pick-ups, which is as short as possible. Any safe route that collects all 3 and returns is correct. Evidences criteria 2 and 4.

Another 20-move route: repeat 5: E, P, repeat 3: W, repeat 2: N, P, repeat 3: N, W, P, repeat 5: S, W (crisp packet, can, sweet wrapper, then home).

Step 4: fix Ffion’s algorithm

(a) Robi picks up the can. Then it goes 1 square east. Then command 7 sends it north, into the pond. Splash!

(b) Command number 7 is wrong. It should be E.

(c) Yes. Fixed, it is N N E E P E E E N N P. Robi goes 3 squares east under the pond, then 2 squares north to the bottle.

The pupil traces to find exactly where the algorithm fails, then changes only that command and traces again to test the fix. Changing command 9 or 10 instead does not work: Robi still lands in the pond. Evidences criterion 5.

Step 5: make it shorter with repeat

Long algorithmShorter algorithm using repeat
(a) E E E E E P N N N N Prepeat 5: E
P
repeat 4: N
P
(b) W W W W W W Wrepeat 7: W
(c) N N N N E N Prepeat 4: N
E
N
P

(d) 11 commands before. 4 lines with repeat.

(e) Aled’s algorithm takes Robi 7 squares west, back to the shed. Seren’s algorithm picks up the sweet wrapper.

(f) From my Step 3 algorithm: N N N N becomes repeat 4: N, S S S becomes repeat 3: S and W W W W W becomes repeat 5: W.

The pupil spots where the same command repeats and uses the right number each time. In (c), only the 4 N commands in a row can be repeated; the single E, N and P stay as they are. Evidences criterion 6.

Step 6: change the algorithm

(a) repeat 7: E, then P, then repeat 4: N, then P. The apple core is 7 squares east of the shed.

(b) Robi ends east of the swing (south of a tree is also right). The last P picks up nothing, because there is no litter there, so it is not needed.

(c) Add repeat 4: S then repeat 5: W. Robi goes back down to the crisp packet square, then west along the bottom to the shed.

(d) I changed repeat 4: N to repeat 2: N. Robi ends 2 squares south of the bottle, next to a tree. The tree is east of Robi. I took away the last P because there is no litter there.

The pupil changes a number to change the outcome, predicts the new ending and describes it with a position word. In (c), Robi cannot go west first, because the pond is in the way. Evidences criteria 2 and 6.

If you finish early: answers

Gethin: repeat 3: E N goes E, N, E, N, E, N. The 6th move sends Robi north into the pond, so it is not safe. repeat 2: E N lands Robi on the can. Then add P.

All 5 pieces of litter: the shortest routes take 26 moves. One is: N N E E P (can), N N N W P (sweet wrapper), E E E E S P (bottle), S S S S P (crisp packet), E E P (apple core), then repeat 7: W back to the shed. That is 4 + 4 + 5 + 4 + 2 + 7 = 26 moves.

Why this response is secure