Code Crew G2 / Week 02 / Tuesday
2/6
Week 02 Β· Two Boxes, One Ship

Tuesday

Copy a box
// Copy one box and lower another
⏱ about 15 min
Rocket the inventor holding his engineering tablet

Copy a box!

Rocket has a plan for a test ship.

He wants its speed to match its height.

He could write the same number two times.

But Nova knows a faster way.

A line can copy one box into another!

Raven wonders if the first box goes empty.

WARM-UP: TWO BOXES
  • Check the name tags.
  • Tap what Nova says.
set height to 2
set speed to 6
say height
?
set speed to 3
set height to 5
say speed
?
The number 4 is copied from the height box into the speed box

Copy one box into another

Set speed to height copies a number.

Nova peeks in the height box.

Nova puts the same number in speed.

set height to 4
set speed to height
say speed
say height
Raven the explorer with her wrist computer

What do you notice?

Height still holds 4.

A copy does not empty a box.

Now both boxes hold 4!

COPY THE BOX
  • Read every line.
  • Tap the answer.
set height to 2
set speed to height
say speed
?
set height to 5
set speed to height
?
set height to 3
set speed to height
say height
?

Build a copy test.

Speed must match height.

Nova says speed, then lands.

BUILD A COPY TEST
  • Read each card.
  • Fill, copy, say, then land.
1line 1
2line 2
3line 3
4line 4
The program: set height to 2, set speed to height, set height to 5, say speed

The copy happens once

The copy happens when its line runs.

Later lines about height do not reach speed.

TRICKY COPIES!
  • Track both boxes.
  • Tap what Nova says.
set height to 1
set speed to height
set height to 4
say speed
?
set height to 2
set speed to height
change speed by 2
say height
?
programspeed holds 4?
set height to 4, set speed to height?
set height to 2, set speed to height?
set height to 4, set speed to height, change height by 1?
set height to 4, set speed to height, change speed by 1?

You copied a box!

Set speed to height makes a copy.

Height keeps its number too.

See you tomorrow, Crew!

← Monday