You are on page 1of 2

KS3 Computing

Robotics: Spheros
Lesson 2: Shapes and Loops
You will need:
Task 1: Using the tape draw a square on the floor. Masking tape
Create a program to make sphero to trace a square on the floor using the
roll and delay blocks, and think about the four heading angles you will
need.

Task 2: Now try to trace a triangle, and think about the three heading angles you will need.

Evidence

Screen shot of your program

Refactoring with Loops

Task 3: Now let us refactor your code so that it draws a square using a loop.

Refactor is a common term used by developers that means to improve the way your code is written
while still making sure it performs that same action.

The code will appear shorter and therefore more efficient

Evidence

Screen shot of your programh

Questions: Why do you think using a loop would be useful to programmers?

Questions: What other word(s) do programmers use to describe a loop?


KS3 Computing
Robotics: Spheros
Lights and Sounds
Challenge - Lights & Sounds
Now try to add extra to your program by including lights and sounds as your sphero traces a square.

Planning
What are the four colours you propose to use?
I would use red green and yellow

Write your answers as a percentage of Red, Green, Blue and Yellow.


?

Question
How do loops make it easier to create a shape with five sides, ten sides, or even 100 sides?
Because if all lengths are equal you could use only a few variables which wouldhhb

Reflection Time
Discussion: Discuss the following questions with your partner:
What is a loop?
What are the benefits of refactoring your code to use a loop?
Are there actions you repeat every day? If you could program these actions, how would you write a
loop to repeat them for you?

A loop is a function that can enable your program to replay forever without
stopping.For example in everyday life, you are always breathing therefore if I
were to program someone breathing in a loop and the functions I would usE
would be ‘ inhale’ then ‘ exhale’ and I could loop these actions allowing a
continuous breathing which can create a use In everyday life.

You might also like