Skip to content
RoboLearn
Not completed

Algorithms and sequences

What you’ll learn

  • What an algorithm is
  • Why robots need precise, ordered instructions
  • The three building blocks: sequence, selection and repetition

Algorithms

An algorithm is a precise list of steps that solves a problem. Recipes and directions are algorithms. A robot follows its algorithm exactly, with no common sense, so every step must be clear and in the right order.

“Make a sandwich” is vague. “Take two slices of bread. Spread butter on one side of each slice…” is an algorithm.

The building blocks

Block Means Example
Sequence Do steps in order Drive forward, then turn, then stop
Selection Choose based on a condition If the path is blocked, turn
Repetition Repeat steps Do this 4 times; or keep going until the line ends

Almost every robot program is these three blocks combined.

Good algorithms are

  • Precise: “turn right 90°”, not “turn a bit”.
  • Ordered: steps in the right sequence.
  • Finite: they end, or repeat on purpose.
  • Tested: you walk through them before trusting them.

Finished this lesson?