Loading...
Bonjour! Kalimera! I'm Rebecca, your computing teacher.
and today we're going to be making a translation quiz.
So for that, you're going to need your Scratch account and you're also going to need a pen and paper to make any notes that you need to.
And don't forget try your best to remove any distractions out of the way so you can really try and focus on the lesson.
Once you've done all of that, we can begin.
In this lesson you will decompose a problem and you'll select appropriate constructs to solve a problem.
So what is decomposition? What I want you to do is try and remember what that word means.
And I want you to pause and write that down using your pen and paper now.
So pause while you think about that.
Fantastic.
So decomposition is breaking a problem down into smaller, more manageable sub-problems. So hopefully you had something like that written down.
Sometimes a problem can seem very overwhelming because it is too big to solve.
When you break it down and solve a piece at a time it becomes much easier to manage.
So you're going to be given a scenario today which is called a translation programme.
And here is the scenario.
Your Modern Foreign Languages teacher would like to have a programme that tests the translations of 10 common words.
They have given you the task of creating the quiz in Scratch.
You can choose any language for the quiz but your teach advises that you start with the language that you use in your Modern Foreign Languages lessons.
The 10 words to be tested are and those are all those 10 there.
I'm not going to read them for you but those are the ones that you can look at.
And these are fairly common words that are used when you're out and about talking in different languages.
That's why they're important to test quite early.
So the programme should tell the player which language they will be tested on.
Give the players some instructions for how to play.
Start the quiz, including setting up the list of words.
For each word the quiz should translate the word into the desired language using the Translation Extension.
Display the word in that language.
Ask for the English word from the player.
Check if the input is correct.
Give feedback.
So say if they're correct or incorrect and then keep a score and after 10 words had been quizzed it should display the score out of 10.
Now that can seem quite overwhelming when you look at it first time, and it's sort of been decomposed cause you've input in little steps for you to follow, but it still is quite overwhelming.
It's a massive programme that you've got to make.
And if this is one of your first big programmes that you've ever made then you're going to think, Oh gosh, this is way too hard.
And you know, this is a completely normal feeling and the better you get at decomposition, the better you're going to get like looking at these problems, thinking, okay, if I start here then I just work my way through then I'll get there in the end.
And this is like the resilience that you'll build up as you become a better programmer.
And the reason I've highlighted that one on the screen there is 4a.
Translate the word into the desired language using the Translate Extension.
I can imagine that if you've never translated a word in Scratch you'll be like, why on earth have I got to do that? I haven't got a clue what that means or how to do that.
And you can become a little bit like, Oh I don't think I could do this.
This is way too hard.
And this is a completely normal feeling.
It's totally okay.
But what we're going to do, I've got it.
We're going to do this and we're going to get through it.
Okay.
So try not to panic or worry about it because we're going to break the problem down into small manageable chunks and we're going to get through it together.
So first of all, let's start and just go without worrying a bit.
Or what on earth is the Translation Extension and how does that actually work in Scratch? So I'm going to show you how to do that now.
When you log into Scratch you'll see you've got the Create button button at the top and that gives you a fresh Scratch programme to work with.
So no code there at all, completely blank.
And then you're going to want to give it a name a sensible name.
So I'm going to call it Translate.
And then I've got to instal the Translate Extension.
So to add extensions in Scratch you just go all the way down to the bottom, to that corner and you've got Add Extension.
There's lots to choose from but we want the Translate Extension.
That's the one we're going to be using today.
And you'll notice that down here we've now got translate that appears here and we've got two extra blocks that we can use to do some translation.
And this top one here says translate hello to Serbian and actually you can choose different options for different languages as well.
Whoops.
So these are my two blocks.
What I'm going to do is I'm going to make a really short programme that just asks for user for a word and then it translates the word back to them.
So to start that off, I'm going to bring in the Event block because I want it to happen when the green flag has clicked.
And I'm just going to zoom in a little bit so that you can see that.
So when green flag clicked.
Then I want to ask the user to enter a word.
And sometimes people go to Looks for ask cause I do this too cause I sometimes forget.
But this doesn't ask.
This just says something on the screen.
It won't ask for an answer.
It won't ask for any input.
So what we want to do, if you want to ask for something we go to the Sensing block, and we get to the Ask block here.
And this will bring up that prompt on the screen so that somebody can type it.
So the question I want to ask is what word do you want whoops, to translate.
Like that.
And then any answer is held temporarily in this answer variable but I want to store it in a different variable.
So I'm going to add a variable called Word.
So I want to make a new variable.
I'm going to call it Word like this and then I'm going to make it so that it sets my variable word to the answer.
So go back to Sensing.
And then if you notice, you've got this sausage shape there and this sausage shape there.
And that means that I can drag things into it, that are same shape.
So set word to answer.
So anything that is typed in here when the user is given the prompt is going to be held in that variable Word.
So I've got them to type it in.
The answer's being held somewhere.
Now I want to do something with that word.
I want to translate it back to the user so that they can see it.
So this is where I go back to that Say block because I want to say what the translated word is.
So I've got my Say block but they only say hello for two seconds cause that's not going to be what I need.
I want it to translate my word.
So if I go to my Translate block now you can see that I've got translate hello to Serbian.
If you look as well, you've got this sausage shape and here you've also got the sausage shape So that means that I should be able to move into there.
So I'm going to do that now.
You've got say translate hello to Serbian for two seconds.
Well, I don't want it to say hello.
I want it to say whatever's being held in the variable word.
So now I'm going to drag the variable word in like that.
And I don't know Serbian, so I'm going to change it to French cause I know a little bit of French so that will help me test to see if it works.
So they've got, let's just look at the programme again.
So it's asking what word to translate.
Whatever the answer is it's going to hold it in the variable word and then it's going to translate that word into French and it's going to display it for two seconds.
So let's see if my programme works.
So I'm going to type in hello.
Bonjour! What! Hey, it works.
So that's fantastic.
So let's stop it again and I'm going to run it again and I'm going to try a different word.
Good bye.
Aurevoir! Okay so I know it's definitely working.
It's asking you something, it's setting that into a variable called Word and then it's repeating that word back but in the translated language.
So that is how you use the Translate block in Scratch.
To help you practise using the Translate Extension I've given you a Parsons puzzle.
So a Parsons puzzle has been created for a translation programme.
The programme should ask the user to enter a word.
The word should then be translated in French back to them and this should be repeated three times.
And when you open up this puzzle, you're going to see that all of the blocks of code are there but they're all jumbled up and mixed up and your job is to put them in the right order.
The link for the Parsons puzzle can be found here.
So ncce.
io/TranslatePP and then you'll see all those blocks of code and I want you to spend some time thinking about the order of that to make it work.
Remember, it's got to ask for the word it's got to translate the word and that's got to happen three times.
So see if you can put those blocks into the right order.
Have a go.
Great that's fantastic.
So did you get it right? Here's the solution for you.
So if you didn't get it right, you could go back now you can have a little go and just put it in the right order but hopefully you got it right and you tested it and it was all working really well.
So well done.
Looking back at the problem we need to solve with our translation programme though, hopefully when you look at 4a, it's not looking too overwhelming.
That section that says, translate the word into the desired language using the Translate Extension cause hopefully now you know how to do it.
So you're feeling a little bit more confident about when you get to that bit when we're solve the problem later on.
So let's start actually solving the problem.
The first part is tell the player which language they will be tested on.
And the second part is give the player some instructions for how to play.
So these are all just instructions for the learner that are going to appear on the screen.
So you got to think, well what blocks might I need to use for those? Do you think it might be the Ask block or do you think it would be the Say block? Have a think.
What do you think? It's just going to be the Say block, isn't it? Cause it's just giving them instructions and telling them information.
It's not asking them a question.
So what I want you to do is for that section I want you to think about the words that you're actually going to write in Scratch that are going to be said to the user for this game.
So write this down using your pen and paper and think about it.
So what's Scratch the cat going to say to the user.
They need to introduce the game stating the language.
So it's up to you now to decide which language you want to use.
I'm going to be using French.
So if you're following along with me and you want to make sure it's exactly right then you might want to do French but it really doesn't matter.
You can choose a different language if you want to.
And I want you to provide some instructions for how to play.
So this is going to be remembering it's 10 questions 10 words, and they need to they'll be given the word in your chosen language and then they'll type the translation for that word and it'll tell them whether they're correct or not.
So you've got to introduce the game saying the language and then provide some instructions for how they're going to play.
So pause the video now and have a think about what you're going to write.
Now that you have planned what Scratch the cat is going to say at the start of your quiz, we're going to start programming it in Scratch.
Now, if you think you know how to do this you might want to have a go yourself but if you want a little bit of help then you can watch my demonstration.
And if you do get started by yourself and you start finding it a little bit tricky you can always come back and watch the video anyway.
So it's completely up to you.
So if you want to join along with me then you can watch this demonstration otherwise you can skip forward and start doing it yourself.
I started a new Scratch programme and I've called it Translation Quiz cause that's a really sensible name for this quiz that we are doing.
And I decided that I want to break my problem down into manageable chunks.
And I'm going to do that as well by putting it into subroutines because that means that I can write everything in separate subroutines and then have my main programme that calls subroutines and carries out some tasks within the main programme.
This makes it easier to break it down into manageable chunks.
But also when you're looking at it, it's easier to test because you can just test little subroutines.
You can pull subroutines out and test other parts of the programme.
And it also stops your programme being absolutely massive because sometimes in Scratch you can have these really huge programmes that go all the way down your screen.
So it helps us sort of minimise that as well.
So it's really sensible to use subroutines in this situation.
So I'm going to start off by doing a subroutine, just for that start-up message.
So I'm going to go to my blocks and I'm going to make a block and I'm going to call it Start-up.
And I'm going to make sure that it says the start-up instructions so for that step one.
So I'm going to go to the Say block cause we don't need to ask we just want to say.
So I want to say welcome to the translation quiz and my next one, you will be tested on your French in this quiz.
So that is my start-up message.
So that would be my step one.
And then step two was the instructions for the user.
So I'm going to have another block, another subroutine.
I'm going to call it Instructions and I'm going to move it around.
And then I've got another Say block You will be tested on 10 common words.
For each word you will translate from French to English.
And then I might even say something like Good luck! Like that.
So now I've got my two subroutines and I've got my step one and I've got my step two.
If I press the green flag, is anything going to happen? What do you think? Let's have a look.
Nope, nothing's happened.
So why has nothing happened? We've got no green flag and we haven't called those subroutines so that's why nothing's happened.
So I need to go to my Event block, when green flag clicked and then I've got to call my subroutines And the first subroutine is the start-up one and the second subroutine is the instructions one.
So now when I press the green flag, my instructions appear.
Welcome to the thing.
Welcome to the quiz.
It's going quite quick that is.
So now I can, because that's gone quite quick I can actually slow it down so I can do that was quite Let's just watch it again.
To the translation quiz.
You will be tested on your French in this quiz.
You'll be tested on 10 common words.
For each word- I think it probably needs to be three seconds.
Really depends on how fast you can read that, isn't it? Good luck, doesn't need to be very long at all.
So let's just look at it now.
Welcome to the translation quiz.
You will be tested on your French in this quiz.
You'll be tested on 10 common words.
For each word you will translate from French to English.
Good luck.
Okay.
So that's really good timing now.
So I know that those instructions work and those subroutines work, but if I wanted to test this programme and I got really bored of keeping looking at those instructions all the time, I can just temporarily move those blocks out of the way and test the rest of my programme.
That's why it's so handy to have this in subroutines because you can just pull them out the way.
And you'll see more of that when we start programming more and more.
So that's step one and two and you're going to have a go at it yourself now.
Pause the video to start your task which is to start creating the translation programme.
And then you can resume when you're done.
Awesome.
Hopefully you got that done.
Now we're going to be looking at the third step now.
The third step is to start the quiz including setting up the list of words.
Now, if you remember from lesson four, we learned about lists and you might've remembered some of the blocks of code that you can use to actually set up your own list.
But if you've forgotten, then that's absolutely fine or if you just need a little bit more support you can watch the demonstration video.
But if you think you know how to do it and you want to have a go then just carry on and just start doing that step three.
It's completely up to you.
But if you want to code along with me, then please do so now.
What I want is a subroutine for the quiz.
So the main running of the quiz can happen in its own subroutine.
So I'm going to do that bit first.
I'm going to go to my blocks.
I'm going to make a block and I'm going to call it Quiz cause this is going to be the main part of the quiz.
And just put that down there.
And at the moment I just need something like the quiz is about to start.
So I'm going to have a Say block and I'm going to do The quiz is starting and just dot, dot, dot, like that.
And to make sure that it runs as well I've got to call the block in my main programme.
Choose quiz.
And then the other part that we've got to do is to populate this list of words that are going to be tested.
So now I'm going to make another subroutine for populating the list.
So I'm going to Populate Word List like that and I've got another subroutine.
So I'm going to move down a little bit so that you can see.
So thinking back to lesson four, I've got to go to variables and I've got to make a list and the list is going to be called Word List.
And then we get all of our blocks appear for lists here.
And we also get the list appearing on the screen in our programme which is probably going to cause us a little problem later on so we might have to fix that too.
So in order to add words to our word list we need to find the block to add things to the word list.
So have a look.
It's the top one.
I gave you a little clue there.
Add a thing to word list.
So if I just drag that block underneath.
Now I'm not going to do all the words.
I'm just going to do three.
I've got hello.
I've got goodbye.
And I've got please.
So there are 10 words and I'll show you those later on so that you can use them when you're doing yours.
So we got hello, goodbye and we've got please.
So what I'm going to do is I'm going to run the programme.
Before I run the programme though, I've got to make sure that this word list has been populated and I want that to happen before the quiz actually starts.
I've got to make sure that I put this call in the right place.
So I've got populate word list.
And to be fair, it could happen here or it could happen just before quiz.
I'm going to put it there, I think.
And I'm going to run my programme.
So I'm going to press the green flag.
And now you'll see what I mean by taking a long time to read all of these texts in order to get to the bit where I want to actually test for my programme.
It takes well it's all those seconds.
Three, six, nine, 12, 14 Seconds, 15 seconds, 16 seconds.
I got to wait 16 seconds to realise that my programme has worked and it's put hello, goodbye, and please into a list.
Now because these are in subroutines what I can do is I can take that bit off and I don't need this bit when I'm testing, do I? So I can just do it like this and take these bits out.
So now I want to press the green flag.
It should just go to populate list, lets see what happens.
Oh no, this isn't good, is it? So it's added hello, goodbye, and please.
Let's just see what happens again.
And it's added again and it's added it again.
This is not good a tool for my programme because we're going to end up with tonnes and tonnes of repeated words in my quiz and it's not going to work properly.
So testing your programme is so, so important just to make sure that it works.
Now, the problem we've got is every single time we press the green flag, it's going to populate word list and it's going to add those three words to the end of the list.
So what we've got to do is we're thinking, well what needs to happen at the very start of the programme to make sure that list is empty? So let's go and have a look at the blocks again and just spend a few seconds just looking down that list of blocks and just see if you can think which block I might need.
It is the Delete all of Word List block.
And that might seem a little bit strange to have that at the beginning because surely it's empty at the beginning because it's the start of the game.
But if you don't have that instruction in there then it won't be empty as we've just seen in that example.
So let's just run it now and see what happens.
Let's just try again.
There we go.
And now we've only got three words in there and I'm going to run it one more time just to double-check.
Yeah.
It's only those three words in there.
We've also got this problem here cause at the moment all those words are in there and that's going to be a real clue for your player.
What words I got to type in.
You don't want to be giving them all the answers.
So what we want to do as well is we want to hide the word list too, so we can hide the list here.
So we've got hide and show.
So we've got hide list.
And we probably wouldn't want to show the list for a while.
So let's just keep it as hide list for now.
We might show list later on.
So now I can see that it's disappeared but remember for testing purposes you might want to show the list just to help you out.
So I'm just going to show the list as well.
Just keep that block there for now.
So just to remind me that I need the show list and the hide list.
So if I'm testing, I can bring that back in like that.
So I'm just going to keep that there just to remind me because otherwise it's going to disappear and I'm not going to be able to test it later on.
So if you ever wanted to see your list you just drag that block in again.
You can actually just double-click on it like that and it works.
And then when I run it, it'll disappear again.
Have a go yourself.
The 10 words that you need to use are on your screen.
So it's hello, goodbye, please, thank you, yes, no, maybe, sorry, how much and English.
Those are the 10 words that you've got to put in your list.
And remember if you do get stuck and you forget things you've got this video so you can just rewind and you can go and have a look and get a bit of help if you need it.
Okay.
So enjoy doing your list and then come back when you're ready.
Well done.
You've now done three parts of our problem and we're now looking at the fourth part.
So for each word, the quiz should translate the word into the desired language using the Translate Extension and display the word in that language.
Now this is a bit Step four is probably the most challenging part of the whole problem to solve.
So if you haven't been following along yet it might be a good idea to start following along now and just to see, but if you're really confident and you really want to just have a go, then go for it and do it.
But if not follow my demonstration it's absolutely fine to be able to just coding along with me.
We're all here learning and practising together.
So I got this.
I got you.
All right.
So if you want to watch the demonstration then that's absolutely fine.
Follow it along now.
For each word in my list, I need to translate it and then display that translated word to the user as part of the quiz.
So what I've got to do is figure out how to access that first word in that list and then each word as we move on.
So I'm just going to show you the list again.
So remember, I've got my handy little block of code here.
So double click and I can show you my list.
So what location, what index location is the first word at? It's index location one.
So I've got to make sure that the first word that I look at is the word at index location one because that's going to be my starting point.
I'm not going to worry too much about all the other words at this point.
I'm just going to try and get that first word to translate and display onto the screen, just to get me started.
So I'm going to go into my quiz subroutine cause this is where I want it to happen.
And I'm going to have a variable to hold the index value of the word that I'm on.
So I'm going to have a variable called oops not a list, going to have a variable, go up here, called Index.
And this is going to hold the value of the first index location.
So set index to what? And if I run my programme it should hopefully change this variable to what? Yep.
And it does.
You can see it's hidden my list again so I can just double click down here.
So at the beginning of the game is going to set index to one and now I need to find the word at index location one and I need to display it for the user.
So I need to say.
I'm going to go to the Say block.
Say.
I'm going to go to the Translate block.
If you don't have the Translate block installed remember you can go to add extension.
Now I've got translate hello to Serbian for two seconds.
So it's not what I want.
I'm going to be doing French.
And then I've got to focus on this bit in here.
So it's the word at index location one.
So I've got to figure out how on earth do I get the word index location one into this sausage shape here.
So if I go to Lists, which is on my variables.
Ah, item.
So translate item one of word list.
Now I could just leave it there and it probably would work.
But what I want to do is I want to include that variable index.
So I'm going to find the index variable which is up here and I'm going to drag that on.
So now I'm going to see if this works.
I'm just going to move everything over it.
So the more you programme, the more you do, the more messy your screen gets and that's why these subroutines are so important because they allow you to just focus on one little part.
So we're going to run it now and just see if it displays hello on the screen.
Let's just have a look.
Yeah, it has.
So it's translated hello to bonjour and it's displayed it on the screen.
And does that happen every time? Does it go to two or three or does it always go to one? Lets have a look.
The quiz is starting bonjour.
So I've got to a point now, where it's accessed that first word in the list and it's translated that first word.
So what have I got to do next? Remember that in this part of the decomposition we are only focusing on translating those 10 words and just displaying that translation on the screen.
We're not worrying about the bit where the user has to type in the answer and it checking the answers correct or not because we can work on that later.
We're just focusing on this one part.
So at the moment though, it only looks at the item in index location one which is hello.
So that's not helpful to us at the moment, What I've done is I've just spent a little bit time adding all 10 of those words in and we've now got 10 words in our list.
So what would I do? Cause at the moment, it's only just looking at item one and we needed it to look through each item.
So we're going to have to start to introduce some repetition to our programme, which means you've got to introduce a loop.
So remember we've got those three types of loop.
We've got a forever loop, a repeat loop, and a repeat-until loop.
There are three options.
So which one do you think we could choose? It's definitely not going to be a forever loop because a forever loop is just going to keep going on forever and we don't want to do that.
And then, so then we're looking at repeat 10 or we're looking at repeat until something is 10 or zero or whatever.
So again, you could choose either of those but the easier one to choose in this situation it's just repeat 10 because it's doing the hard work for us.
So I'm going to introduce the repeat loop and quite handily, it already says repeat 10 so I don't even have to put that.
So if I just do that and then I press the green flag it's just going to still look at index location one because we haven't changed index.
It's always going to be one.
So for the whole game is just going to say bonjour, bonjour, bonjour, bonjour, bonjour, the whole time which isn't right.
So what we need to do now is make it increment by one each time this loop runs.
So let's see if we can get that to work.
Our next block is going to be change index by one.
I'm just going to drag that in and I'm going to put it after because it's one at the beginning and we want to do the first translation then we want it to increment by one.
So I'm going to run it now and see what happens.
And hopefully it starts to go through the list.
Yeah, it looks like it's going through my list.
S'il-vous-plait.
Is it going to get all the way to the end? You can keep an eye on the index here.
Like that.
And Anglais was the last word in the list which is English in French.
So it has worked.
You'll notice that it's got to index 11 but this doesn't really matter because our programme is working.
The reason it's done that is because after it's done that 10th word it's incremented it by one.
But that doesn't matter because it's not going to affect our programme in any way cause our programme still works.
In other situations that might matter but for this programme, it doesn't.
So I'm just going to run it again just to double check to make sure that that variable goes back to one and it does.
So it starts at one and then it keeps incrementing.
So now it's working all the way through the list.
So we've got it to, for each word in the list, it's translating that word and it's displaying it in that French language for the user.
So we've done that bit.
We decomposed that little bit.
Now it's time for you to have a go.
So pause the video to complete your task, which is to translate and display those words and resume the video once you're done.
Fantastic.
So we've got pretty much halfway through our decomposition of our big problem that we started at the beginning of this lesson.
So look how much we have achieved this lesson.
That is fantastic.
And I hope that you found it, you know a little bit challenging, but not so challenging that you want to give up and stop doing it because that's the whole point.
We want to be challenging ourselves, but not be so hard that we give up.
Cause that would be awful, wouldn't it? So well done.
That is absolutely fantastic that you've got this far and you've got your translation programme working to this point.
That's brilliant.
So please, if you want to share your work if you'd like to please ask your parent or carer to share your work on Instagram, Facebook or Twitter, tagging @OakNational and #LearnwithOak.
We'd really love to see the changes that you've made.
And in lesson six, we'll be finishing that programme off so it becomes a full working quiz.
So hopefully I'll see you next time.