TactivergeLite

Lite / Discovering How the World Works / Week 31

The rules inside your machine

A plant waterer that waters whenever there's water in the tank sounds fine, until you ask what happens when the soil is already wet.

About 30 min · 3 goals · Reviewed by the founders' mentors · Full interactive version

Why should I care?

'Simple logical reasoning (a rule or flowchart)' is a capstone requirement. A flowchart is a conceptual prototype of your machine's brain: you can test it completely on paper, before any code or circuit exists.

Predict

The rule is 'if the tank has water, open the valve'. The soil is wet and the tank is full. What does the machine do?

  1. Waits, because the soil is wet
  2. Opens the valve and waters anyway
  3. Lights the warning
Guess first, then reveal

The rule never asks about the soil, so it waters even when the pots don't need it. Over four days that floods the pots and empties the tank. The fix: water only if the tank has water AND the soil is dry.

Discover

Set the two sensors to each of the four combinations and trace the intended flowchart. Then switch to the buggy version and find the combination where it does the wrong thing. Use the truth table to check you've found every mismatch.

What the interactive shows (text version)

Flowchart as text: every 10 minutes, read the sensors. Question 1: is there water in the tank? If no, light the refill warning and wait. If yes, question 2: is the soil dry? If no, wait 10 minutes. If yes, open the valve for 10 seconds, then wait. The buggy version skips question 2, so it waters whenever the tank has water, including when the soil is already wet.

You can also open the interactive on the full site when you have a faster connection.

Understand

Rules as if-then

A machine's decisions can usually be written as if-then rules: if the tank is empty, then light the warning. If the tank has water and the soil is dry, then open the valve for 10 seconds. Write them in plain language first; they can become code or a circuit later.

Flowcharts

A flowchart draws the rules. Diamonds are yes/no questions. Rectangles are actions. Arrows show the order. Most machines loop: after acting, they wait and start again. Trace it with your finger for one situation at a time.

Test every combination

Two yes/no inputs give 2 × 2 = 4 combinations; three give 8. List them all in a truth table with what the machine should do and what your flowchart does. Any row where they differ is a bug. This tests your logic completely, for free.

Explain it another way

Intuitive

A flowchart is a choose-your-own-adventure book for the machine: each answer sends it to a different page.

Technical

The intended rule is water = tankOK AND dry, warn = NOT tankOK. The buggy rule is water = tankOK. They differ in exactly one row: soil wet, tank OK, where the bug waters and the intended rule waits.

Mathematical

With n yes/no inputs, a truth table has 2ⁿ rows: 2 inputs → 4 rows, 3 → 8, 4 → 16. Simple rules are easy to test completely; complicated ones quickly aren't.

Applied

The sorting-machine Build's level 2 asks for an 8-row rule table covering every combination of three sensor readings: a truth table in all but name.

Worked example 1

Write a rule for a night light that comes on when it's dark and someone is moving.

If dark AND movement, switch the lamp on for 2 minutes. Truth table: dark + moving → on; dark + still → off; light + moving → off; light + still → off.

Common mix-ups

Practice

Practice, not a test. Answers are checked on our server; a wrong answer gets a hint and another try. Nothing is saved.

rows

Practice 2. In a flowchart, what does a diamond mean?
Practice 3. Rule: 'If the soil is dry OR the tank has water, open the valve.' The soil is wet and the tank is full. What happens?
Practice 4. Which test proves a two-input rule is right in every case?

Apply it

Write your capstone machine's rules as if-then sentences, draw them as a flowchart, and fill in a truth table for every combination of inputs. Mark any row where the flowchart does the wrong thing, and fix it. Add the flowchart, in words, to your Design Studio project.

Reflect

Which combination of inputs did you nearly forget to think about?

Write your answer on paper or in your own notes. Lite never stores what you write.

← Input, process, output: drawing your systemPlanning a fair test →