-
People make decisions every day.
-
For example before you go outside
-
you kind of have an IF statement that says,
-
IF it's raining,
THEN I need to get my jacket.
-
And, computers are amazing once you decide those kinds of statements,
-
that they can reliably execute those things at unbelievable speed.
-
And so, a computer program really
-
is a little bit of math and some
-
IF statements, where the decision gets made.
-
So, in this puzzle the
-
IF block helps the zombie make a decision,
-
it checks something.
-
For example let's use the block that says, "if there's a path to the left,"
-
and put a "turn left" command inside it.
-
So, we're telling the zombie to check its surroundings,
-
see if there's that path on the left,
-
and if so, make that turn.
-
And then we use the "move forward" block inside this "repeat"
-
to get it to keep moving forward as long as
-
it just wants to go straight.
-
Then when there's the turn, the IF block
will tell it to make this turn to the left.
-
And you can see, if we do that
-
if we're taking the turn to the left and otherwise moving forward,
we'll achieve our goal.
-
So it's an example of using an IF statement,
-
which is really a fundamental concept in computer programming.
-
One of the first things I learned was how to write a program to play tic-tac-toe.
-
So I had IF statements to say okay,
-
IF the other person is about to win go ahead and block that spot.
-
So have fun learning how to use IF statements. It's a key concept.