Robot Directions & Sequencing
Computers follow instructions one step at a time, in exact order. Build a sequence of commands to guide your robot to the goal.
Follow the Robot Step by Step
Press "Step" to execute one command at a time and watch the robot move.
This is your robot! Click 'Step' to follow each command one at a time.
Sequencing and Algorithms
What is an Algorithm?
An algorithm is a sequence of steps that solves a problem. Every program you have ever used runs on algorithms.
When you build a command sequence to move the robot, you are writing an algorithm. The robot follows each step exactly as written.
- Step 1 runs before Step 2
- Every step must be clear and specific
- The robot does not guess or improvise
Why Order Matters
The same set of commands in a different order produces a completely different result. Try it with the robot.
"Forward, Turn Right, Forward" takes you somewhere different than "Turn Right, Forward, Forward." This is why programmers must think carefully about sequence.
- Swapping two steps can change the entire outcome
- Order is one of the three core ideas in programming (along with loops and decisions)
Debugging: Reading the Steps
When a program does the wrong thing, programmers debug it by reading the steps one at a time to find the mistake.
If your robot does not reach the star, go through your sequence step by step. Ask: "After Step 1, where is the robot? After Step 2?"
- Use the "Step" button in Learn mode to trace step by step
- Look for the first command that gives an unexpected result
- Fix that command and re-run
Real Computers Follow Sequences Too
Every app, game, and website you use runs step-by-step instructions like the ones you are building here. Computers are very fast at following these steps, but they follow them one at a time.
- A game character moves based on a sequence of physics steps
- A search engine follows steps to rank results
- Your phone alarm follows steps to check the time and ring
- Robots in factories follow motion programs just like this grid robot