Lesson / Scratch & Game Design

How Does a Game Decide?

The Quiz of Questionable Knowledge has received the answer 'moon cheese.' Its code must decide whether that is correct, give useful feedback, and move on without awarding seventeen points.

Lesson plan

  1. Write the question

    Turn one quiz rule into a question with a true or false answer.

  2. Test both branches

    Compare text and numbers, then run the true and false cases.

  3. Build the quiz

    Add questions, feedback, score, and question state.

  4. Try awkward answers

    Test capitals, wrong answers, and inputs that should not score twice.

  5. Trace one decision

    Demonstrate the condition and explain why its branch ran.

Learning goals

  • Write a rule as a true-or-false question.
  • Use if and if/else.
  • Compare text and numbers.
  • Resolve decisions that can overlap.
  • Explain why a particular branch ran.

Small examples

if answer = 'Ottawa'

compare text for equality

if score > 5

compare a number with a threshold

if touching danger

use a sensing result

else

handle the other answer

Guided project

Quiz of Questionable Knowledge

Answer useful questions while the host insists that at least one distractor involves moon cheese.

Build This Project
Students build

Several original questions, Answer input, Correct and incorrect branches, Score.

Ideas in use

Conditions, Variables, Input, Messages, State.

Finish line

A working version with a tested change, one repaired problem, and a clear explanation.

Teacher checkpoints

  1. 1The student states the condition as a question.
  2. 2Both the true and false paths can be shown.
  3. 3The comparison uses the intended value and type.
  4. 4Each question can score only once.
  5. 5The student adds one decision independently.

Common mistakes

  • Using assignment language instead of comparison.
  • Checking a changing condition only once.
  • Two branches score the same answer.
  • An else belongs to the wrong if.

Optional challenges

LEVEL 1

Builder

  • Add feedback for a wrong answer.
LEVEL 2

Inventor

  • Accept two equivalent spellings.
LEVEL 3

Boss Level

  • Choose question difficulty from score.

End-of-class demonstration

  1. What question does the code ask?
  2. What makes it true?
  3. What happens otherwise?
  4. Can two outcomes happen together?
  5. What rule did you add?