Let's start with a program the computer can run that you already know how to write.
Take out Jam
Take out PB
Take out Bread
Open other cabinet
Take out plate
Take out knife
Take first piece of bread out of package
Put on plate
Take second piece of bread out of package
Put on plate
Spread jam on bread
Spread PB on bread
Put bread pieces together
Do you think I'm joking? Tom made up a virtual computer -- that's like being in a virtual school during lockdown, not really the same, but it looks sort of like it, and mostly works the same -- that pretends to be your average kitchen, with a pseudo-English for its programming language. Not the whole English language, just the things we talked about so far. Like it probably wouldn't know about orange marmalade and raisins, which Tom puts on his own PB sandwich.
OK, here's your computer:
After you see how it works, you can click this button to copy Steve's script to this panel:
Like I said, it's pretty limited, but at least you can see that you can write (and run) computer programs. Later we will see how to do this kind of program in Java.
But first, have some fun in the virtual kitchen. You can click this button to copy Steve's Breakfast script into the edit panel. That's all this "kitchen" computer knows how to do, Breakfast and PBJ. But you can change them around and see what happens when you run it.
[memo to Steve: we can do conditionals and iteration and even subroutines and variables in Kitchen, if you want. How about this as a final Kitchen script:
"Morning":... and of course it would error off when it gets to the "Go to School" line, perhaps with some cutsie message about there's no school because of COVID, or at least that this computer doesn't know about school.]
Go to School
Are you ready to start programming for real? That's next.
<<Previous | ToC | Next >>
[2021 February 18]