Ayanna writes programs using the following commands that direct her robot to draw shapes.
| Command | Explanation |
|---|---|
Pencil down |
Puts the pencil in position to draw as the robot moves |
Move |
Moves the robot a given distance forward |
Turn CW |
Rotates the robot one quarter turn (\(90\degree\)) clockwise |
Turn CCW |
Rotates the robot one quarter turn (\(90\degree\)) counter clockwise |
For each program, follow the code to draw the shape. You may find grid paper helpful.
Pencil down
Repeat 4 times
Move 5 cm
Turn CW
End
Pencil down
Move 4 cm
Turn CCW
Move 2 cm
Turn CW
Move 2 cm
Turn CW
Move 6 cm
Turn CW
Move 6 cm
Turn CW
Move 4 cm
End
Write a program that would direct Ayanna's robot to draw the given rectangular U-shape.
Themes: Computational Thinking, Geometry & Measurement