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

Fill the gaps

Week 7 · 1.3 What happens next? · 3 lessons
2

Words into code

Computing 1: Topic 1.3, pp. 33–48
GoalChange an algorithm in words into a robot code that works.
New words
algorithm · the plan in wordscode · the same plan as command cards
Explanation

An algorithm tells us the plan in words. Code is the same plan as command cards. Change each step into cards. ‘Forward three’ is three forward cards. A turn is one card. Put clear first and GO last. Trace it to check.

clearforwardforwardturn leftforwardGOGO
Worked examples
Algorithm: forward two, turn left, forward one. Code: X F F L F GO. The robot goes up two and then left one.
Algorithm: turn right, forward four. Code: X R F F F F GO. The robot goes right along the bottom.
Algorithm: forward three, turn left, forward two, back one. Code: X F F F L F F B GO. The robot ends one square back.
Class activity

Write it twice: write an algorithm in words for the robot to go forward two and turn left. Then write the code cards. Show it to a friend. Do they get the same cards? Check each card against the words.

Practice
1
Write the code for: forward one, turn left, forward two.
2
Say this code in words: X F F R F F GO.
GO
3
The robot starts at the bottom right facing up. Code: F F F L F. Where does it end?
4
Algorithm: back one, turn right. How many cards (not counting X and GO)?