Code Crew G2 / Week 01 / Thursday
4/6
Week 01 Β· Memory and the Missing Bug

Thursday

Change the box by one
// A memory box holds one number
⏱ about 15 min
Rocket the inventor holding his engineering tablet

Add one to the box!

Rocket has a new idea for the auto-pilot.

He wants the ship to climb a little more.

Can a line add one to a box?

Nova beeps. Yes, it can!

Coders call it changing the box.

Rocket cannot wait to try it.

WARM-UP: NEWEST NUMBER WINS
  • Read every line.
  • Tap the answer.
set height to 4
set height to 1
?
set height to 2
set height to 6
say height
?
The program: set height to 2, change height by 1

Change by one

Change height by 1 adds one.

The box held 2.

Now it holds 3.

set height to 2
change height by 1
say height
A logbook: the height box holds 2, then 3, then 3

Nova keeps a logbook

After line one, the box holds 2.

After line two, it holds 3.

Nova peeks and says 3!

WHAT DOES NOVA SAY?
  • Track the box line by line.
  • Tap what Nova says.
set height to 5
change height by 1
say height
?
set height to 1
change height by 1
change height by 1
say height
?
set height to 3
change height by 2
say height
?

Build a flight up 4 spaces.

Start the box at 3.

Then add one before Nova flies.

BUILD A FLIGHT UP 4
  • Start at 3, add one, fly, land.
1line 1
2line 2
3line 3
4line 4
Raven the explorer with her wrist computer

What do you notice?

What if a change line goes missing?

The box would stay stuck.

Raven writes that down as a clue.

set height to 4
change height by 1
change height by 1
say height
afterbox holdstrue?
line 14?
line 26?
line 36?
Nova says5?

You changed the box!

Set fills the box.

Change adds to the box.

A logbook tracks every line.

Tomorrow: your own flights!

← Wednesday