π Recipes

Imagine telling a friend how to do a silly dance: βhop, turn, hop.β Now imagine you could give that whole thing a name β βDanceβ β and from then on just say βdo the Danceβ instead of listing every step. π
That one idea is how programmers build huge things without losing their minds. They call it a function; let's just call it a recipe.
The big idea: name it once, use it forever
A recipe is just a bunch of steps with a name. Once you name it, you don't repeat the steps anymore β you say the name and all the steps happen. (Grown-up programmers call this a function.)
The magic trick: recipes can be made out of other recipes. So a giant job becomes a short list of names, each name a smaller list of names⦠all the way down. That's how a whole game fits in a brain: it's recipes inside recipes, and you only ever look at one little piece at a time.
Your turn: teach the robot recipes
Build the Dance recipe out of basic moves. Then build Big Show β and notice it can use your whole Dance as a single block. Run them and watch the recipe unpack into steps.
π Dance
π Big Show
π‘ Big Show uses π Dance as a single block. Change Dance, then run Big Show again β it changes too, without you touching Big Show!
Discovery missions
Try each one, tick it off, then peek at the secret.
βοΈRun Dance. Then add a π¦ Hop to the Dance recipe and run it again. How much did you have to rewrite?
π’Run Big Show. Look at the strip of little steps β is it longer than the number of blocks in Big Show?
πChange the Dance recipe, then run Big Show WITHOUT touching Big Show. What happens?
π«Make the Dance recipe empty, then run Big Show.
π¦ΈThink back to your game. Every chapter drew the hero. Did anyone re-draw it from scratch each time?
π New thinking tool unlocked! You now know:
- π A recipe (a βfunctionβ) is a group of steps with a name.
- π€ You run all those steps by saying ONE word β the name.
- πͺ Recipes can contain other recipes, so big ones stay short.
- π§ Change a recipe once and every place that uses it updates.
- π¦Έ Real games are recipes calling recipes (like drawCharacter).