Programming Tryout

(You Already Know How)

Video Transcript

What does it mean to program a computer?

Basically it's the same as telling your kid sister how to make a peanut butter and jelly sandwich -- one step at a time, in order, nothing left out -- except you are giving the same instructions to a computer.

You already know how to make a PBJ, and telling the computer to make it is exactly the same, so you can be doing it in ten minutes today, right here, right after you've finished watching the video. And if you enjoy this little experiment in controlling the computer, think about signing up for the Programming course and then you can write games like Rock-Paper-Scissors and Hangman and Pong and even Tetris. This year. If you want to.

OK, I'm going to show you how to do PBJ, here in the video (transcript), then when it stops -- or even right now -- go back to the page you started in and scroll down a little, and you will see a panel for typing your program in, and a kitchen counter image next to it, like this:


We type our instructions in the panel, like...

open cabinet
then click the Run button and the result shows up over there in the kitchen image.

So how do we make a PBJ? You tell your kid sister [type these into the program panel, or copy & paste...]

open cabinet
get jam
get peanut butter
get bread
Then click Run.

[If you typed correctly...] OK, that seems to work so far. What else do we need? Right, [type some more, lines 5 & 6...]

get utensils
put it together
Click Run again.

One more thing, computers are quite stupid, you need to tell them everything they need to do. You see all those 'Assume...s' there under the animation? Real computers don't assume anything, they need to be told every little detail. You can do that...

Scroll down below the program panel and image, there is a Quick Reference section that looks like this:

Sandwich Programming Language Quick Reference

See Kitchen Get stuff Put it together Put stuff away




Close cabinet. Get PB from pantry. Open jelly. Put loaf back.
Close drawer. Get piece of bread. Open other cabinet. Put PB back.
Close jam. Get plate from cupboard.  Open pantry cabinet. Get another piece of bread.
Close loaf. If T/F then Otherwise Repeat num ... Next
Close peanut butter. It is date Open peanut butter. Spread jam on bread.
Get bread from pantry.  Open bread. Put bread pieces together. Spread jelly on bread.
Get jam from pantry. Open cabinet. Put it on plate. Spread PB on bread.
Get jelly from pantry. Open drawer. Put jam back.
Get knife from drawer. Open jam. Put jelly back. Input num.


These are all the instructions this Kitchen Computer knows how to do. If you look at what it assumed, then insert into the program one of these instructions, whatever it was assuming, at or before it printed out the 'Assume...' message, one at a time the 'Assumes' will go away and what is left will be your program. Here's the first one (in red)...

open cabinet
get jam
get peanut butter
get bread
get plate from cupboard
get utensils
put it together
Oh wait, that made a new (different) Assume message. OK, fix that one too...
open cabinet
get jam
get peanut butter
get bread
open cupboard
get plate from cupboard
get utensils
put it together


You can do the rest.

If it makes your sandwich, you are ready to do real programs in the Programming class, so sign up.

If it doesn't work for you, if you can't get rid of the messages, or it just stops -- not to worry, computers are really picky, this kind of thing happens all the time to all of us -- so we have live mentors and teachers in the class who can get you unstuck. You can still do it. If you want to.

Oh by the way, scroll all the way to the bottom, there are some hints for fixing messages we know about. You are probably too smart for us to think of everything you might do to make it stop, but you can try different things to see what might work. Programmers spend a lot of time doing that.

Anyway, go back and try your own PBJ -- then scroll down below the Quick Reference section and sign up for the class.

Or you can do it here: 


Here are descriptions of projects done in recent years by high school students in our Summer Workshop.
Not the first year, but you could be doing a project like one of these too:

https://alexanderhhs.github.io/NWAPW-Teams/index.html

https://sites.google.com/site/shsgalbraith/non-class-pages/nw-advanced-programming-workshop


Rev. 2022 May 10