Code Crew G2 / Week 02 / Monday
1/6
Week 02 Β· Two Boxes, One Ship

Monday

Two boxes, one ship
// Copy one box and lower another
⏱ about 15 min
Rocket, Raven, and Nova the drone-bird together

Welcome back, Code Crew!

Raven opens the auto-pilot program again.

She reads it slowly, line by line.

This time she finds two memory boxes.

One box is height. One box is speed.

Rocket asks if two boxes get mixed up.

Nova beeps. Let us find out together!

WARM-UP: MEMORY BOX POWERS
  • Read each little program.
  • Tap what Nova says.
set height to 4
say height
?
set height to 2
set height to 6
say height
?
set height to 3
change height by 1
change height by 1
say height
?
A test ship flight path that drops down at the same spot

Back to the mystery

The ship still drops at the same spot.

The auto-pilot uses two boxes.

Bug hunters must read them both.

Two memory boxes: height holds 3 and speed holds 2

Two boxes, two numbers

Nova keeps two boxes now.

Height holds 3. Speed holds 2.

Each box has its own name tag.

Raven the explorer with her wrist computer

What do you notice?

A line only touches the box it names.

The other box stays the same.

set height to 3
set speed to 2
say speed
say height

Nova says 2 first, from speed.

Then Nova says 3, from height.

Each box kept its own number!

WHICH BOX? WHICH NUMBER?
  • Read every line.
  • Check the name tags. Tap the answer.
set height to 5
set speed to 1
say height
?
set speed to 4
set height to 2
say speed
?
set height to 3
set speed to 6
set height to 1
fly up height
?

Build a two-box test.

Nova must say 3, then say 5.

Fill each box before Nova peeks in it.

BUILD A TWO-BOX TEST
  • Read each card.
  • Make Nova say 3, then say 5.
1line 1
2line 2
3line 3
4line 4
programNova says 4?
set height to 4, say height?
set speed to 4, say height?
set height to 4, set speed to 1, say height?
set speed to 4, set speed to 2, say speed?

Two boxes, no mix-ups!

Each box has its own name.

A line only touches the box it names.

Great work, Crew!