← Back to course
Intro to CS 9-10 / Week 02 / Mission Quest
6/6
Week 02 · Algorithms in Pseudocode

Mission Quest

Mission Quest: The human computer
// Exact steps, variables and expressions
⏱ about 20 min

Mission Quest: The Human Computer

The crew pushes two crates together in the greenhouse. Comet lays out a row of index cards, each with one line of pseudocode.

"Tonight, Wren is the computer," she announces. "He may only do exactly what the cards say."

Wren sticks two notes on the crate, labeled waterLevel and lightLevel. "No guessing. No skipping. Ready."

Nova hovers over the cards. "Remember," she says. "The newest value goes on the note. The old value goes away."

Comet flips the first card. Wren picks up his pencil and grins.

  1. An algorithm is a finite set of instructions that accomplish a specific task.
  2. Algorithms can be written in natural language, diagrams or pseudocode.
  3. Every algorithm can be built from sequencing, selection and iteration.
  4. A variable holds one value at a time: the most recent value assigned.
  5. An expression evaluates to a single value, in a set order of operations.
  6. Always acknowledge code that came from someone else.
◇ THE HUMAN COMPUTER
You need five index cards or paper slips, three sticky notes or scraps, and a pencil.
One player is the programmer. The other is the computer.
The programmer writes five index cards, each with one line of pseudocode, using two or three variables.
Use only assignment lines, simple math and one DISPLAY at the end.
The computer makes a sticky note for each variable and runs the cards in order, exactly as written.
Before the computer starts, the programmer writes a secret prediction of what will be displayed.
Compare the display with the prediction. If they differ, trace the cards together to find out why. Then swap roles.
For a grown-up
Ask: what does the assignment arrow do to the old value on a sticky note?
Ask: when did the computer's answer surprise the programmer, and why?
This is the same hand tracing that programmers use to find and correct errors.
QUEST CHECK
  • Read the question.
  • Tap your answer.
The cards say: score gets 10, then score gets score plus 5, then display score. What shows?
The cards say: steps gets 3, then steps gets 8. What does steps hold?
The computer skips a card because it looks unimportant. What has gone wrong?
PLAY THE HUMAN COMPUTER IN ORDER
  • Tap a card.
  • Then tap its spot.
1First
2Second
3Third
4Last
On paper, draw your family's five cards in a row, with the sticky-note values shown after each card.
What do you call a table that records each variable's value after each line? Type two words.
WHY THIS EXERCISEA trace table makes every change visible, so mistakes have nowhere to hide.
← Friday