Computing Lesson 1
Computing Lesson 1
Warm up
Work in groups of four. You will play a game that involves four players.
The object of the game is to reach the middle block first. Each player gets into position on one
corner of the board below.
Each player can:
• only move one block at a time
• can block the move of another player by placing an X on one of the blocks.
Do you remember?
Before you start this unit, check that you:
• can follow, understand, edit and correct an algorithm that uses repetition
• know how to develop programs with repetition
• can test different parts of a program to identify and debug errors.
10
Practise
1 Complete the following algorithm for a third sprite in the chasing game. The Dinosaur
sprite should chase the Polar bear.
Algorithm Name: Chasing Game Dinosaur
Step Instruction
❶ When the __________ is clicked
❷ Set size to 50%
❸ Point towards __________
➍ Glide 0.5 seconds to __________
➎ Repeat steps ____ and ____ thirty nine more times
❻ Stop program
2 Create the code for this algorithm.
3 Run and test your code. Does the Dinosaur chase the Polar bear?
11
Step Instruction
❶ When the Green Flag is clicked
❷ Say What’s your name? for 2 seconds
❸ Broadcast message 1 for 2 seconds
➍ Say What’s your name? for 2 seconds
➎ Broadcast message 2 for 2 seconds
❻ Say What’s your name? for 2 seconds
❼ Broadcast message 3 for 2 seconds
❽ Stop program
12
Practise
1 Fill in the algorithm for Dani’s response to the second message. Dani should say that they
are called Dani-b.
Step Instruction
➍ Stop program
2 Write the algorithm for the third costume for Dani’s response to the third message.
3 If you haven’t already, create the code for the Fish Sprite broadcast algorithm and the
Dani Responds Costume 1 algorithm.
4 Create the code for the Dani Responds Costume 2 algorithm.
5 Create the code for the Dani Responds Costume 3 algorithm.
13
The programmer
Kala is skilled in writing programs
using different programming
languages. She knows how to
program in Scratch!
She writes the software for
games and other programs.
14
The designer
Jarno is responsible for how a program looks and
feels for the user.
If the program is a game, Jarno is the artist who
designs the look of characters, background scenes
and different levels.
The testers
Jim makes sure that the finished program
does not have any bugs. He has to test the
program systematically.
If he finds a bug, it means that the program is not
doing what it was intended to do. Jim records the
error, and sends it back to the programmer and
designer to fix.
Practise
1 Which one of the following statements is true about a project manager?
A They design how characters in a game look.
B They are skilled in writing programs.
C They ensure that the program has no bugs.
D They are skilled in organising tasks.
2 Which of the following is NOT true about a project manager?
A They are skilled in communicating with the members of the team.
B They assign the task to each member of the team.
C They ensure the tasks get done on time.
D They are responsible for the look and feel of the software.
3 State whether the following are true or false:
a Testers are optional when creating a final program.
b Without a programmer, you cannot create the final program.
c A programmer knows only one computer language.
d A computer engineer knows how hardware functions with the software.
4 Work in groups of 3–4.
You have been asked to recruit some students at your school onto your Program Team.
Write a letter describing the different roles on your team and the skills that each role needs.
15
Go further
1 Copy and fill in the blanks using the word bank below.
captain tester project manager programmer computer engineer designer
A ____________ is responsible for how a program looks and feels. The ____________ ensures that
there are no bugs. The ____________ is skilled in writing programs. The ____________ ____________
designs and builds the hardware components that works with the software. The ____________
____________ is skilled in communication and is the team ____________.
2 In Stage 4, you learnt how to add a sub-routine.
You wrote code for the Chasing Game in an earlier Learn panel.
a Write the Scratch code to match the Jump Sub-routine algorithm below. Add the code
to the Penguin. This code will make the sprite jump.
16
Challenge yourself!
You will create a new chasing game.
This game will contain three sprites: the Fish, the Octopus and the Shark.
The Fish should:
• Glide for 3 seconds towards the mouse pointer when the Green Flag is clicked
• Change to a random costume at the end of each glide
• This should repeat 8 times.
The Octopus should:
• Say “Are you coming?” for 1 second when the Green Flag is clicked
• Glide for 1 second towards the Fish
• Point towards the Fish at the end of the glide
• Broadcast a message at the end of each glide
• This should repeat 12 times.
The Shark should:
• Glide for 1 second towards the Octopus when it receives a message
• Say “I heard you!”
• Change costume at the end of the glide.
1 Write the algorithms for each sprite.
2 Write the code for each sprite.
3 Run and test your programs. Do the sprites behave as described?
17
My project
1 a Conduct research to determine if there are any other people that can be added to a
programming team.
b What skills should they have?
c Create a flyer to advertise the job position. Include the skills that this person must have
on your flyer.
2 In the first Learn panel and Practise panel, we created an algorithm for up to three sprites
to talk to each other. Create an algorithm where four sprites talk to each other. Convert the
algorithm to code.
3 In this project, we will create a new Chasing Game. However, we will make it more complex
by having the sprites record their position by drawing a circle.
a Add the Pen extension blocks to the palette.
b In the algorithm below, Sprite 1 moves randomly six times. Write the code to match this
algorithm. (Hint: see Learn panel – Algorithm with two objects.) You can use any sprite.
Algorithm Name: Chasing Game Sprite 1 – Random position
Step Instruction
❶ When the Green Flag is clicked
❷ Set position to: x =125, y = 70
❸ Say “You can’t catch me!” for 1 second
➍ Glide 2 seconds to random position
➎ Call Circle Sub-routine
❻ Repeat steps 3 to 6 five more times
❼ Stop program
c Below is the algorithm for the sub-routine to draw a circle. Write the code to match the
Circle Sub-routine algorithm.
Algorithm Name: Circle Sub-routine
Step Instruction
❶ Define Circle sub-routine
❷ Set pen colour to 50
❸ Pen down
➍ Move 10 steps
➎ Turn right 36 degrees
❻ Repeat steps three and four 10 times
❼ Pen up
18
d Add two additional Sprites into your Chasing Game project. You can choose any sprites.
The code for Sprite 2 and Sprite 3 is exactly the same as Sprite 1 except that:
• Sprite 2 should follow Sprite 1
• Sprite 3 should follow Sprite 2
• Different pen colours should be chosen.
Remember: A pen colour of 50 is blue. Different numbers are used for different colours.
e Test your code and debug any errors.
19