Download Scratch Worksheet 3 Writing an Algorithm File

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
Transcript
Game Design
Worksheet 3
Writing an Algorithm
An algorithm is simply a sequence of instructions that someone else (or a computer) could follow.
It is usually written in structured English like, for example, the directions you might give to someone
who is lost. “Turn next left, take second right, go over the roundabout and turn left after the petrol
station.”
What happens when one sprite touches another?
Write out a sequence of instructions below that you would give to the sprites if you were directing
them in real life. You can use a similar set of words and structures to those given below:
When? Forever / When clicked / On a key-press
Condition? If touching… / If time exceeds… / If x = y…
What you want to happen? Change colour / end game / go back to start
Write your sequence of instructions here…
Read through your sequence of instructions. Are they clear enough? Do they make sense?
If you are happy with them, try and transfer your algorithm into real code blocks in Scratch. Look at
some of the functions in Scratch before you dive in. Does it work? If not, why not? See if you can
figure it out – this is a crucial part of programming! Code doesn’t always work first time and being
able to logically deduce why is a real skill.
What else could you add to your game?
Think of something else you could add to your game and write out a sequence of instructions in
structured English on the other side of this sheet to achieve it.
Use your imagination and don’t worry about being unsure exactly how to do it in Scratch. What you
are concerned about is how and when something is to happen.