-
I was in 8th grade when I learned to program.
-
I first learned how to make a
-
green circle and a red square appear on the screen.
-
You just learn these lessons, and there aren't that many of them,
-
and you just eventually can get to the point
where you can do almost anything that you want.
-
Computer science is just learning
how a computer works and how it thinks,
-
so that you can teach it to do new things.
-
These days what you can do in computer science
is pretty much amazing.
-
I think it's the closest thing we have to a super power.
-
(Tanya: Computer Science student) In the next hour we're going to play a game
-
that will teach you the basic concepts of programming.
-
Usually programming is all in text but we'll use Blockly,
-
which uses visual blocks that you drag and drop to write programs.
-
Under the hood you're still creating code.
-
To start off we're going to build code for a program that will help
-
this angry bird move through a maze to get to
the evil pig that stole its eggs.
-
Blockly is split into three main parts.
-
On the left is the bird's maze where your program will run.
-
The instructions for each level are written below the maze.
-
This middle area is the tool box,
-
and each of these blocks is a
command that the bird can understand.
-
The white space on the right is called the workspace
-
and this is where we'll build our program.
-
If I drag the "move" block to our workspace and press "run",
what happens?
-
The bird moves forward one box on the grid.
-
And what if I want the bird to do something
after the move forward on one box?
-
I can add another block to our program.
-
I'm going to choose the "turn right" block and I'll drag it underneath
-
my "move" block until the yellow arrow appears
-
and then I'll drop it and the two blocks will snap together.
-
When I press "run" again,
the bird will perform the commands that are stacked,
-
from top to bottom, on our workspace.
-
If you ever want to delete a block,
-
just remove it from the stack and drag it to the trash can.
-
After you've hit "run", you can always hit the
"reset" button to get the bird back to the start.
-
Now, let's get those pigs!