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

Repeat and shorten

Week 19 · Unit 8: Be an artist · 3 lessons
3

Back and forth

Computing 2: Unit 8, pp. 106–121
GoalUse back and marker up in an algorithm to draw a letter with arms.
New words
back · moves the robot one step the other way, without turningarm · a short line that sticks out of a longer linecorner · a place where two lines meet
Explanation

Back moves the robot the other way without turning. It is a good way to return to a corner. The letter F has a tall line and two arms. The robot draws the tall line and the top arm. Then it backs along the top arm to the corner. Now it can turn and go down to draw the middle arm. If we do not want a line, we put the marker up first.

StepInstruction
1Start
2Marker down
3Forward 4
4Turn right
5Forward 2
6Back 2
7Turn right
8Forward 2
9Turn left
10Forward 1
11Stop
Worked examples
The letter F. The robot starts at the bottom left, facing up. It draws the tall line, goes along the top arm, backs to the corner, goes down and draws the short middle arm.
StepInstruction
1Start
2Marker down
3Forward 3
4Marker up
5Back 3
6Stop
Back also helps to return to the start. This robot goes forward 3, then puts the marker up and goes back 3. It draws a line of 3 steps and goes home without drawing anything new.
Why does the algorithm for F use back 2? After the top arm the robot faces right. Back 2 takes it to the corner in one step. Turning round would need more steps.
Class activity

Draw an F: make a grid of 3 columns and 5 rows on paper. Use a pencil as the robot. Follow the algorithm for the letter F one step at a time with a partner reading it out. Does your F look right? Then change “forward 1” in step 10 to “forward 2”. What happens to the middle arm? Is it still an F?

Practice
1
A robot starts on C1, facing up. It does forward 3 and then back 1. Which square does it stop on? Rows are numbered from the bottom.
ABCD54321
2
In the algorithm for F, which step takes the robot back to the corner of the top arm?
3
Why is back 2 better than turning round twice and going forward 2?
4
Write an algorithm for a robot to draw a line of 3 steps and then return to the start without drawing.