← Back to course
Intro to CS 9-10 / Week 03 / Mission Quest
6/6
Week 03 · Making Decisions

Mission Quest

Mission Quest: Rule cards
// Booleans, conditions and alert rules
⏱ about 20 min

Mission Quest: Rule Cards

It is game night at the outpost. Wren writes reading cards, each with a number from 0 to 100.

Comet writes rule cards in pseudocode. "My rules are perfect," she says. "No reading can sneak past them."

Wren shuffles his deck. "Let's investigate that."

He flips a 50. Comet's rule says less than 50 shows one message, and greater than 50 shows another.

Nothing happens. Everyone laughs, Comet loudest of all.

Nova glows a happy cyan. "Great discovery," she says. "Every gap you find tonight is a bug you will never ship."

  1. A Boolean value is either true or false. A comparison evaluates to a Boolean.
  2. AND is true only when both conditions are true. OR is true when either or both are true.
  3. Selection decides which parts of an algorithm run. An IF with an ELSE always takes exactly one path.
  4. The same decision can be written in different ways. Readability helps you choose.
  5. Rules can carry bias, so test them with many kinds of users and cases.
◇ RULE CARDS
One player is the rule writer. The other is the reading dealer.
The rule writer invents an imaginary plant and writes an IF / ELSE alert rule for it on an index card.
The dealer writes eight reading cards from 0 to 100. Include the exact number in the rule, and one just above and below it.
Run the rule on every card and write what Beacon would show.
Look for a gap: a reading that shows nothing, or a message that does not make sense.
Fix the rule, then swap roles. Try a rule that uses AND for the second round.
For a grown-up
Ask: which reading card found a problem in the rule, and why that one?
Ask: can you think of a rule in daily life that works for most people but leaves someone out?
Testing the exact edge number is a habit real developers use to find gaps.
QUEST CHECK
  • Read the question.
  • Tap your answer.
Rule: IF reading is less than 50, show Thirsty; ELSE show Fine. The card says 50. What shows?
Which card is the best test of a rule that uses less than 50?
Rule: show Bright if light is greater than 80 AND water is greater than 60. Light is 90 and water is 40. Does Bright show?
On paper, draw your family's best rule card. Next to it, draw the reading card that broke the first version.
What do you call a table of test inputs and the output for each one? Type two words.
WHY THIS EXERCISEA decision table makes every case visible, so gaps cannot hide.
← Friday