In this lesson, we will learn about using logical reasoning to predict the behaviour of simple programs, getting your teaching to move around in a square and using scratch!

Step 1: Predicting the Behaviour of our Robot!

Sometimes we need to predict what our program will do so we need to be able to use logic reasoning to be able to read and write your own code!

Question 1.
Below you can see our robot we want to tell her to walk in a square using logic reasoning, you can do this in 4 steps!
The first step is done for you, can you tell me
what the other 3 steps would be?

1. Move 2 steps, quarter turn right

2.

3.

4.

End

Question 2.
Can you draw in the square below what shape this draws?

Repeat 4 times
[ move 2 steps Make a quarter turn right]

HINT: If you are not sure, you can act out the movements with a friend!

Step 2: Lets do it Scratch

Start a new project
Have a look at the Scratch interface to familiarise yourself with it . . .

Remove the cat Sprite
Hint: Right click

Choose ‘New Sprite’ from the library or up-load your own.

Next

Step 3: Your First Script + Drawing with your sprite

Now we need to start our script!

Let’s try making our character start from the same position!

Now we’re going to use tell our program we are going to use the pen tool!

Hint: you can find this code block under Pen

Question 3.

Before we add the next piece of code, can you read the code to the right and write down what shape this will draw?

No Peeking!

Now we can add our code to scratch, does your program draw what you expected?
Hint: you can find the repeat code block under Control


Now test your script! Press the Right Arrow Key What do you see?

TEST + SAVE!!


Lets change some of the numbers.....
What do you think will happen when we change the move number?
Test and Press the Right Arrow Key again, What do you see?

What will happen when you change the repeat block? What shape do you think this will be?
Test and Press the Right Arrow Key again, What do you see?

Now, let’s try changing the amount of turn.
Can you predict the shapes you’ll make?

Here are some cool things to try:
repeat 6 times, turn 60 degrees
repeat 8 times, turn 45 degrees

Now test your script! Press the Right Arrow Key What do you see?

Step 4: EXTRA: Make really cool patterns!

This code is using nested loops, putting repeat blocks inside repeat blocks allows us to create cool patterns, try it for yourself!

Now test your script! Press the Right Arrow Key What do you see?
TEST + SAVE!

Step 5: Let's experiment with the Code!

Try adding the line below in your code. Now press the right arrow key and move mouse around the screen!

Try adding these lines in your code:

You can set any numbers. Now press the right arrow key and move mouse around the screen!

Try to change numbers of any line – degrees, pen size and more. Press the right key and move your mouse. Let’s see what happens!

Here are some examples of what could be done just by changing the numbers.

Now test your script! Press the Right Arrow Key! What do you see?
TEST + SAVE!!

Did this answer your question?