Code Crew G3 / Week 04 / Wednesday
3/6
Week 04 Β· Variables

Wednesday

// Boxes that hold things

Swap the Boxes

Sometimes you want to TRADE what's inside two boxes. To do that you need a THIRD empty box (call it temp). Read carefully:

a = 7
b = 4
temp = a       (now temp = 7)
a    = b       (now a = ?)
b    = temp    (now b = ?)
After 'a = b': a = ____
After 'b = temp': b = ____
β—‡ PARTNER MOVE
Use 3 cups (paper or imaginary).
Put a sticker (or pebble) in two of them. Try to swap WITHOUT temp.
Now try with temp. Easier?

Thursday: Score Keeper

Rocket and Raven are playing tag. Track each player's score in a variable.

ROCKET tag = +1. RAVEN tag = +2. MISS = -1.

RoundEventrocket_scoreraven_score
Start(none)00
1Rocket tags Raven??
2Raven tags Rocket??
3Rocket misses??
4Raven tags Rocket??
5Rocket tags Raven??

Who is winning after Round 5?

Winner:
← Tuesday