Coding Basics Using PB & J

Objective:

     Build the perfect PB&J sandwich


Materials Required:

   - Bread

   - Peanut Butter (or any allergen friendly alternative)

   - Jelly

   - Utensils

   - Plates

   - Paper/Pen


Algorithms

Computers use sequences of instruction called algorithms to complete tasks. The sequence of events is like step by step instructions on how to reach its goal. 

On your paper, write step by step instructions on how to make a peanut butter and jelly sandwich. (Think first this, next, then, and be specific!)

Next have someone else (a friend, a troop leader, etc) follow your instructions to make the perfect sandwich. Make sure to follow these steps word for word, exactly like a computer would! Don't assume anything!

How well did your instructions work?

Mobirise Website Builder
Mobirise Website Builder
Loops

Loops are ways that a computer can do steps multiple times in a row. If you want a character in a game to take 100 steps, you might write out the action to take a step 100 times. That's a lot of work. Instead, you could write it once and say do this 100 times. Thats a lot less work for you!

How can you make a better sandwich using loops? When you spread peanut butter do you do one wipe, or spread it in multiple strokes? How can you do that using loops?

Rewrite your instructions to be more efficient using loops. Now have someone else try and make your sandwich using these new instructions.

Is your sandwich better than before? Were your instructions shorter than before?

Events

Things called events help a computer know when to do something. When you press a button on your keyboard, it types the letter you pressed. You pressing the button is an event because when that happens, this happens. Another example is the baking a cake. When the ingredients are done mixing, put the cake in the oven. When the oven is done, take the cake out.

How can you use events to make your instructions even better? Some people may not like as much peanut butter, so how can they decide when it's enough?

Rewrite your instructions using some of these events. Now have someone else try making a sandwich following these new instructions.

Were two people able to make their perfect sandwich?

Mobirise Website Builder

Not official requirements - supplemental material

AI Website Maker