3 of 1 ·Robot instructions

Lesson 3 · Computational Thinking
Write instructions a robot follows without asking questions.
Algorithms Everywhere
An algorithm is a clear list of steps. For a school bag: check tomorrow's timetable, choose the books, put them in. Try putting three familiar steps in order.
Click to zoomA robot has a tiny vocabularyImagine a robot on a grid. It understands exactly four commands and nothing else:
FORWARD n — move n squares aheadLEFT — turn 90° left, staying putRIGHT — turn 90° right, staying putPICK — pick up whatever is on this squareThat's the entire language. "Go to the treasure" means nothing to it. "Head towards the door" means nothing. You must build everything you want out of those four words.
Click to zoomTurning is not movingThe mistake almost everyone makes on their first try: forgetting that LEFT and RIGHT don't change the robot's square. They only change which way it faces.
So to go from facing north to moving east by two squares, you need two commands: RIGHT then FORWARD 2. Write only FORWARD 2 and the robot cheerfully goes north instead — doing exactly what you said, and not at all what you meant.
7 more parts in this lesson
Walkthroughs, code labs, mini-games and the checkpoint quiz unlock when you buy the course.