Code Crew G2 / Week 03 / Tuesday
2/6
Week 03 Β· Count With a Box

Tuesday

Repeat does the counting
// A steps box counts every round
⏱ about 15 min
Rocket the inventor holding his engineering tablet

Repeat and count!

Rocket counted steps the long way yesterday.

It took so many lines!

Raven remembers a power from Grade 1.

A repeat line runs the lines under it.

Can a repeat and a box work together?

Nova beeps. Let us test it!

WARM-UP: COUNT BY HAND
  • Count the change lines.
  • Tap what Nova says.
set steps to 0
change steps by 1
change steps by 1
say steps
?
set steps to 3
change steps by 1
say steps
?
The program: set steps to 0, repeat 3 times, move right, change steps by 1

Repeat and a box

The repeat runs all the lines under it.

Move, count. Move, count. Move, count.

Steps ends at 3!

set steps to 0
repeat 3 times:
move right
change steps by 1
Raven the explorer with her wrist computer

What do you notice?

Start at 0. Add 1 each round.

The count matches the repeat number!

COUNT WITH REPEAT
  • Read the repeat number.
  • Tap what steps holds at the end.
set steps to 0
repeat 2 times:
change steps by 1
?
set steps to 0
repeat 4 times:
move right
change steps by 1
?
set steps to 1
repeat 3 times:
change steps by 1
?

Build a counter with a repeat.

Count 3 steps the short way.

BUILD A REPEAT COUNTER
  • Start at 0 on top.
  • Put the repeat above the lines it runs.
1line 1
2line 2
3line 3
4line 4
Nova the drone-bird up close

Set goes above the repeat

The set line runs once, at the start.

Under the repeat, it would run every round!

TRICKY COUNTERS!
  • Find the lines under the repeat.
  • Tap what steps holds at the end.
repeat 3 times:
set steps to 0
change steps by 1
?
set steps to 0
repeat 2 times:
change steps by 2
?
programsteps ends at 3?
set steps to 0, repeat 3 times: change steps by 1?
set steps to 0, repeat 2 times: change steps by 1?
set steps to 1, repeat 2 times: change steps by 1?
set steps to 0, repeat 3 times: move right?

Repeat counted for you!

The repeat runs the lines under it.

A change line inside counts every round.

See you tomorrow, Crew!

← Monday