Teacher answer key

Meet the Machine

Gather four kinds of evidence: prediction of relevant state; behavior across varied cases including boundaries; explanation using trace/state evidence; and a reasoned correction of one mismatch. Mark each as emerging, with support or independent using paper or your school’s existing approved process. A challenge pass is machine-behavior evidence, not proof of authorship or complete mastery. Accept equivalent correct programs; the public key is a model, not the only possible answer.

Public teaching material. Solutions are examples; equivalent correct programs may also pass the actual checks.

1. Your First Emoji Program

Move a number into the CPU, print it, and stop.

Open this lesson →

1. Predict and trace

Before running the Try program, predict its output and trace the first three executed instructions. Track the relevant registers, flags or memory as needed. Then step the program to compare.

📥 42
🖨️
⏹️

Queue input: None

Initialize memory: All bytes initially zero

Try prediction key

Output: 42

InstructionPC beforePC afterR0 beforeR0 afterRelevant stateOutput
LOAD01042{"registers":[42,0,0,0,0,0,0,0],"flags":{"zero":false,"negative":false,"overflow":false},"sp":255,"stack":[],"callStack":[],"loopStack":[],"memoryReads":[],"memoryWrites":[]}None
PRINT124242{"registers":[42,0,0,0,0,0,0,0],"flags":{"zero":false,"negative":false,"overflow":false},"sp":255,"stack":[],"callStack":[],"loopStack":[],"memoryReads":[],"memoryWrites":[]}42
HALT224242{"registers":[42,0,0,0,0,0,0,0],"flags":{"zero":false,"negative":false,"overflow":false},"sp":255,"stack":[],"callStack":[],"loopStack":[],"memoryReads":[],"memoryWrites":[]}42

2. Build and check

Write a program that prints 42 exactly once and halts. Use LOAD, PRINT, and HALT.

Required instruction types: LOAD, PRINT, HALT

Example challenge solution

LOAD 42
PRINT
HALT

Actual checker fixtures

Case 1
Input
None
Initial memory
All bytes initially zero
Expected output
42

3. Explain the machine

What is in R0 and output just before PRINT? What PC does HALT leave?

Reasoning and teaching note

R0=42; output empty before PRINT; output 42 after it; HALT at compiled index2.