Computer Science
Grade 2
20 min
The Human Algorithm: Crossing the Room
Students create an algorithm for crossing the classroom, considering obstacles and other students.
Tutorial Preview
1
Introduction & Learning Objectives
Learning Objectives
Define 'algorithm' using their own words.
Create a sequence of commands to cross the room.
Act as a 'robot' following instructions exactly.
Use a 'Repeat' command (a loop) to give instructions.
Find a mistake, or 'bug', in a set of instructions.
Fix a 'bug' to help their robot reach the goal.
How can you tell a robot friend 🤖 how to get a cookie 🍪 from across the room?
We will learn to give instructions like a computer programmer! These instructions are called an algorithm. It's like a secret code for solving problems step-by-step.
Real-World Applications
Following a recipe to bake a cake 🎂
Building a LEGO castle using instructions 🧱
Giving a friend directions to the playground 🗺️
Playi...
2
Key Concepts & Vocabulary
TermDefinitionExample
AlgorithmA list of steps to finish a task. It's like a recipe!1. Pick up cup. 2. Walk to sink. 3. Turn on water.
CommandOne single, clear instruction for your robot.Take one step forward. ➡️
SequenceThe order that you put your commands in. Order is very important!You put on socks THEN shoes. Not shoes then socks! 🧦👟
LoopA way to repeat a command many times.Instead of 'step, step, step', you say 'Repeat 3 times: Step forward'. 🔁
BugA mistake in your algorithm that makes the robot do the wrong thing.The robot bumps into a chair! Oops, a bug! 💥
DebuggingFinding the bug and fixing it! It's like being a detective. 🕵️♀️Adding a 'Turn Left' command so the robot avoids the chair.
3
Core Syntax & Patterns
Single-Step Commands
Give only one clear instruction at a time.
Robots get confused by long sentences. Say 'Step forward', not 'Go walk over there'.
Be Super Specific
Commands must be exact and simple.
Don't say 'turn'. Say 'Turn Right ➡️' or 'Turn Left ⬅️'.
The Repeat Loop
Use 'Repeat [number] times: [command]'
To walk a long way, use a loop. 'Repeat 5 times: Step Forward' is fast to write!
4 more steps in this tutorial
Sign up free to access the complete tutorial with worked examples and practice.
Sign Up Free to ContinueSample Practice Questions
Challenging
A robot starts in the middle of a room. The goal is to touch a pillow in front, then a block behind it, and return to the start. Which algorithm works?
A.Step Forward, Step Backward, Step Backward, Step Forward
B.Step Forward, Turn Around, Step Forward, Step Forward, Turn Around, Step Forward
C.Step Forward, Step Backward
D.Step Forward, Turn Left, Step Forward, Turn Left
Challenging
Your robot's code is 'Repeat 4 times: [Step Forward, Turn Right]' which makes it walk in a square. What happens if you change it to 'Repeat 4 times: [Step Forward, Step Forward, Turn Right]'?
A.It walks in a smaller square
B.It walks in a bigger square
C.It walks in a triangle
D.It walks in a straight line
Challenging
The programmer wants the robot to go to a door. They shout, 'Go that way!' Why is this a BAD instruction for a robot?
A.It's too loud for the robot
B.The robot only understands the word 'Go'
C.'That way' is not a specific, clear command
D.The robot might not want to go to the door
Want to practice and check your answers?
Sign up to access all questions with instant feedback, explanations, and progress tracking.
Start Practicing Free