AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

Debug it everywhere

Week 10 · 1.4 Spot the bug · 3 lessons
1

Count the turns

Computing 1: Topic 1.4, pp. 49–59
GoalFind and fix a bug in a program that should make the robot turn all the way round.
New words
full turn · turning all the way round to face the same way againspin · turn round and round
Explanation

A full turn is four quarter turns. After a full turn the robot faces the way it started. If a program has three turns, the robot does not finish facing the same way. That is a bug. Count the turn cards to check.

RR RR R RR R R R
Worked examples
Kenji wants the robot to face left. It starts facing up. He writes R R. The robot faces down. The bug: one R is missing. R R R works, and so does one L.
A full turn needs R R R R. That is four quarter turns. The robot faces up again, as it began.
turn rightturn rightturn rightturn right
Lola wants a half turn so that the robot faces the opposite way. She writes R R R R and the robot faces the same way. The bug: she needs only two turns, R R.
Class activity

Spin and count: stand up on a spot. Ask a partner to say a number of quarter turns. You turn that many times. Say which way you face. Find how many turns bring you all the way round. Find how many turns face you the opposite way.

Practice
1
The robot faces up. The code is R R R. Which way does it face at the end?
2
How do you fix R R R to make a full turn?
turn rightturn rightturn right
3
You want the robot to face the opposite way. How many quarter turns?
4
The code is L L L L. Does the robot make a full turn?
turn leftturn leftturn leftturn left