Introduction to the Hour of Code

We know that the computer is an instruction execution machine, and we’ve had a look—possibly too intimate—at some of those instructions:

ADD 4000, 2004, 2008

Don’t worry: we’re not going back to that. We’re going to consider instructions at a much higher level—instructions you could give to an angry bird, or a zombie: “move forward,” “turn right,” “turn left.”

The instructions are simple, but the interesting part now is going to be: How can we combine these instructions?

It turns out that there are three basic and interesting ways in which we can combine instructions:

  1. In a sequence, one after another: “Go forward, then turn right.”
  2. In a repetitive structure: “Move forward 12 times,” or “Move forward until you reach the naughty pig.”
  3. In a conditional structure: “If there is a path to the left, then turn left.” Sometimes we want to augment this with an alternative: “Otherwise, go forward.”

There are other ways to combine instructions, but it turns out that these three are sufficient: if we wrote a program that combined instructions in other ways, we could always write an equivalent program—one that does the same thing—using only the sequence, repetition, and conditional structures. And since those other ways can be mind-bogglingly complex, most folks leave them alone nowadays, and so shall we.

I want you to know my daughter completed the Hour of Code when she was at home on Christmas vacation (2013). She’s a poet attending an M.F.A. program in the Far West. She enjoyed it, she posted her certificate on Facebook, where her friends saluted her with comments like, “wicked cool!”, “oh neato!”, and “join the dark side”. And since she enjoyed it, I’m confident you will too.

Let me emphasize one sentence in the lab instructions for the Hour of Code:

“As you go through the Hour of Code, take screenshots showing that you successfully solved puzzles #5, 9, 13, 17, and 20.”

Those screenshots are what you will turn in. The lab instructions also have information about how to take screenshots, for those who are not familiar with that arcane science (and it is more complicated on Windows than it ought to be).

Just remember the screenshots. Don’t get so excited as you’re going through the Hour of Code, successfully controlling your bird and zombie, that you forget to take the screenshots.

Now, I will turn you over to the much more famous and handsomer instructors at the Hour of Code. Well—maybe they’re not all handsomer than I, but if they’re not handsome, they’re filthy rich.