2 · Programmed rules vs. learned behavior
There are two very different ways to make a machine "decide," and knowing the difference is the single most useful idea in this whole course.
1. Programmed rules. A person writes the rules out, step by step, ahead of time — the conditionals (if/else) you met in Intro to Robotics. The machine just follows them.
IF the distance sensor reads less than 10 cm:
stop
ELSE:
drive forward
This is precise and predictable. You can read the rule and know exactly what the robot will do. The catch: a person has to think of every case in advance. Rules are great for "stop if too close" — but try writing if/else rules for "is that a cat or a paper bag blowing across the road?" You'd need a million rules, and you'd still miss some.
2. Learned behavior (machine learning). Instead of writing the rules, you show the machine lots of labeled examples and let it find the pattern itself — exactly the "learn from examples / training data" idea from Young Makers: AI for Kids. Code.org's grades-6-12 curriculum describes this as computers learning "from data to make decisions" rather than from rules a programmer spelled out (Code.org, n.d.).
| Programmed rules | Learned behavior (ML) | |
|---|---|---|
| Who makes the rule? | a person, in advance | the model finds the pattern from examples |
| Good for | clear, countable situations | messy, "you know it when you see it" situations |
| Predictable? | very — you can read the rule | less — it's a learned guess, and can be wrong |
| Example | "stop if closer than 10 cm" | "recognize a stop sign in a photo" |
Real robots use both, on purpose. A self-driving feature might use learned AI to recognize a stop sign in the camera image, and then a simple, hard rule — "if a stop sign is detected, brake" — to act on it. Engineers often keep the safety-critical action as a plain, readable rule, precisely because a learned model is a guess that can be wrong. Hold onto that — it comes back in the safety lesson.
Think about it. For each task, would you use a programmed rule or learned behavior? (a) Turn on a light when a button is pressed. (b) Tell whether a photo shows a dog or a muffin. (c) Sound an alarm if the temperature goes above 100°.
Sources
Code.org. (n.d.). How AI works (machine learning: computers learn from data). https://code.org/ai Micro:bit Educational Foundation. (n.d.-b). micro:bit features overview. https://microbit.org/get-started/features/overview/