Project A: the robot course
Be able to plan a course, steer the robot around it, and fix the instructions when something goes wrong.
Prerequisites
- AGuess, test, learnrequired
- ARepeat: loopsrequired
Everyday explanation
The project: build a course on the floor or in a grid with a start, a goal and at least one obstacle. Write a program that takes the robot (a friend, a Blue-Bot or a sprite in Scratch) all the way there.
Steps:
- Draw the course on squared paper.
- Write the commands — use repeat wherever the same thing happens several times.
- Run exactly what is written. Did it go wrong? Find which command it was and change only that one.
- Show the course and the program to someone else. Can they run it without your help?
Interactive
Example course (R = robot facing right, X = obstacle, G = goal):
R · X · ·
· · · · ·
· · · · G
One program: forward, right, forward, forward, left, forward, forward, forward. Can you shorten it with a loop? (forward, right, repeat 2: forward, left, repeat 3: forward.)
Make your own course harder: two obstacles, or a goal that requires the robot to turn all the way around.
Mastery means
- Plans a course and writes the commands before running
- Finds and fixes an error after a failed run
- Uses a loop where the same thing repeats
Sign in to do the exercises and build your mastery up.
Sources
- CS Unplugged (CC BY-SA 4.0) — CC BY-SA 4.0
- Scratch Wiki (CC BY-SA 4.0) — CC BY-SA 4.0