← Back to course
Code Crew G2 / Week 10 / Monday
1/6
Week 10 Β· The Bug-Hunt Method

Monday

The bug-hunt method
// Four steps to find a bug
⏱ about 15 min
Rocket, Raven, and Nova the drone-bird together

The bug-hunt method!

Last week you read programs ten lines long.

Now the crew is almost ready for the big hunt.

But Raven says a good hunter needs a method.

A method is steps you follow every time.

This week you practice on ships in the hangar.

Next week, you use it on the auto-pilot.

Nova has four steps ready. Let us learn them!

WARM-UP: READ AND PREDICT
  • Read each program, top to bottom.
  • Tap what happens.
set steps to 0
repeat 3 times:
change steps by 1
stop
say steps
?
set height to 5
if height over 3
then land
otherwise say safe
?
set fuel to 6
lower fuel by 2
change fuel by 1
say fuel
?
The four steps of the bug-hunt method on Nova’s hologram

Four steps to catch a bug

Step 1. Keep a logbook.

Step 2. Run part of the program.

Step 3. Check each box.

Step 4. Find the first wrong line.

A logbook with a speed column and a fuel column

Step 1: keep a logbook

A logbook has a row for each line.

Write what each box holds after that line.

Two boxes? Use two columns!

set speed to 2
set fuel to 5
change speed by 1
lower fuel by 1
say speed

Line 3 changes speed. Fuel stays 5.

Line 4 lowers fuel. Speed stays 3.

A line only changes the box it names.

FILL IN THE LOGBOOK
  • Keep a logbook in your head.
  • Tap what the box holds.
set speed to 2
set fuel to 5
change speed by 1
?
set speed to 2
set fuel to 5
change speed by 1
lower fuel by 1
?
set count to 5
set steps to 1
lower count by 2
change steps by 1
say count
?

Now put the method in order.

Which step comes first?

PUT THE METHOD IN ORDER
  • Read each step card.
  • Put the four steps in order.
1step 1
2step 2
3step 3
4step 4
Raven the explorer with her wrist computer

What do you notice?

Every row shows what the boxes hold.

A wrong number in a row is a clue.

set height to 4
set steps to 0
change steps by 1
lower height by 1
change steps by 1
say height
afterheightstepstrue?
line 240?
line 351?
line 431?
line 531?

Word Spot: use, very

Here are new sight words.

Look at each word. Say it. Spell it.

Use: U-S-E.

Very: V-E-R-Y.

FIND THE WORD
  • Listen to the word.
  • Tap it.
Listen and find
?
Listen and find
?
Listen and find
?
Listen and find
?
FILL THE GAP
  • Listen to the sentence.
  • Tap the missing word.
Which word fits?
?
Which word fits?
?

Logbook power, Crew!

The method has four steps.

Step 1 is keep a logbook.

Each box gets its own column.

Great work, Crew!