video

Lesson video

In progress...

Loading...

Hi, I'm Rebecca, your computing teacher.

And this is our final lesson in this unit.

And to in today's lesson, you're going to need your Scratch programmes that you started in lesson five and some pen and paper.

If you want to make any notes while we're going along.

So once you've removed any distractions out of the way we can begin.

In this lesson you will decompose a problem and you will select appropriate constructs to solve a problem.

We do all of that using the translation programme that we started in lesson five.

So let's go back to that scenario just to remind ourselves of it.

So 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 quizzing Scratch.

You can choose any language for the quiz, but your teacher advises that you start with the language that you use in your modern foreign language lessons.

And these are the 10 words that we had to use for the quiz.

And this was all of the list of all that broken down parts of the problem.

And we got to lesson, section four B.

So we've done all of that last lesson.

So now we need to focus on the next part.

So ask the English word from the player.

Check if the input is correct and give feedbacks, we're going to start having a look at that.

And I'm going to do a demonstration.

If you're comfortable, try and have a go doing that yourself, then you can do that.

If you want to code along with me as well, then that's fine too.

If you start doing it by yourself and realise, well, actually I could do with a little bit of help, then just rewind the video, come back.

That's absolutely fine.

If you want to code along with me, then we're going to do that now.

I'm going to start with that first little bit where we're just asking the user to enter the English translation for the word that's been displayed on the screen.

So in order for that to happen, I need to get an ask block.

So I'm going to go to sensing, find ask block, and it needs to go underneath where the word is been displayed, which is there.

And I'm going to say, what is the English translation for this word like that? Now that's just going to ask the question and the answer will be held in that temporary variable answer, but I want to create my own variable for it as well.

So I'm going to go to variables and I've already created a variable called word before.

So I've got that one there, which I can use.

And then I can go to set underneath set word to answer.

So she need to find an answer and there it is.

So what I'm going to do now is I'm just going to test it.

It's not going to work properly, but I'm just going to test it and just see what happens.

I'm going to go to the green flag.

It's got bonjour what is the English translation for this word? And I'm going to say, hello Au revoir, what is the English translation for this word goodbye.

So at the moment it is moving through, it's using that loop, that repetition, it's moving through each word in the list and it's displaying it.

And then it's saying what is the English translation for the word? And the next part is to check if that word is correct to check if it's correct, what I'm going to have to do is have some kind of condition so that it checks.

If the word that the user is entered is the same as the word that is in the list to see whether it matches up.

Because if it does much, then they're going to be correct.

And if it doesn't match, then they're going to be incorrect.

So I'm going to need to use a selection statement.

So I'm going to go over to the control box and look at these selection statements.

So I've got an if that's like this, and then I've got an if else as well.

So I'm going to have to get two pieces of feedback, one for correct and one for incorrect.

So which if block am I going to need to use? Yeah, it's the if else block.

Cause that will give me feedback whether they got it right.

Or whether they got it wrong and I need it after set words.

So let's just put it there and then drop that down cause that's moved to the wrong place.

So now I've got my selection block.

I need to add my conditioning and I'm looking for the equal to one, the equal to block put that in.

So we want word to be equal to whatever word we are testing.

So I'm going to find the oops, the variable.

I'm going to go to word.

So if word is equal to the word in the list that we checking then it's going to say correct.

Otherwise it's going to say incorrect.

So I'm going to get my say blocks in, its very nice and easy.

So correct.

And then this one is incorrect.

Okay, now this condition here is going to be fairly tricky for us to think about.

Cause what we're trying to do is we're trying to check if the word that the user has entered is the same as the word that is that we're currently on in our list.

So we're currently on the item at the index location one.

If we're looking at the first one and actually this block here, item index are word list actually does pretty much the same thing.

And it's still a sausage block.

So it's definitely going to go in there.

I'm going to try just duplicate in this little bit and just see if it actually works.

Cause if we look at this, it kind of makes sense.

So we've got that if word.

So the word that they have typed in is equal to whatever's the item at the current index of word list.

So if it's an index one and testing the word number one, then it should be right.

So let's have a go press the green flag bonjour.

And hopefully it's going to say I'm correct.

Hey! It worked.

Now for the next one.

I'm going to get it wrong and see what happens.

I'm going to just type that it's incorrect.

Brilliant.

And then the third one is please.

And I've got it correct.

So it seems to be working so I can just go really quickly through them now Just to see if it all works, It looks like it's working.

Get that last one, right English.

Brilliant.

And now it's got to the end of my programme.

So now we're starting to get it work.

So we've asked for the English word.

We have checked if it's correct and we've given feedback, whether it's correct or incorrect.

So now it's time for you to have a go pause the video, to complete your task and then resume when you are finished.

Also, so we are nearly there.

We are nearly there at the end of our programme, the final points are five and six, which is to keep a score.

And then also after 10 words have been quizzed it should display the score out of 10.

So we're nearly there.

I'm going to do a demonstration just like a habit with all the others.

What I want you to do though, is if you think you can do it yourself and you want to have, go and have a go before, or if you'd like to code along with me, then that's absolutely fine too.

I'm quite happy for you to code along with me if that's what you need.

So it's up to you.

You can go off and do it yourself and then come back or code along with me now.

If you want to keep track of the score for our game, what are we going to need in order to hold that score somewhere.

We're going to need a variable.

So I need to make another variable I'm going to go to, I always forget where it is, variables.

It's because it's there's two orange balls on the screen in it.

I always get confused.

So make a variable score.

That is going to be my score variable.

So that's going to hold the score.

Now at the beginning of the game, what is that score going to be? It's going to be zero because they haven't got anything right, and they haven't got anything wrong.

Cause it's going to start at being zero.

So we're going to set score to zero at the beginning at the same time as we set our index to zero.

So we've got a score we've set it to zero, but how do we increase the score? Every time they get the question right we want increase the score by one.

And if they're getting it wrong, we're not going to decrease the score we're just going to not do anything with score at that point.

So how do we know where in our code do we know that they have definitely got something right.

There's a condition somewhere on our code and it's checking whether they're right or not.

And it does something he says, they're correct.

So where is my increment going to go? Where do you think? So it's going to go here.

So we've got if word is equal to the word that we testing, let's say correct.

So at that point we know for definite that they've got it right, because we've, we've tested it.

We know it works.

So at that point we can change the variable by one as well.

So we can say it's correct.

And we can change it by one.

So I've got their change score by one.

So I'm just going to do the first one and just see if it actually works.

So at the beginning of the game, we've got index is one and we've got score zero.

But if we get the answer right, does it go up by one? Yes, it does.

So as soon as it's said, you're correct.

It goes at by one.

And just try it for one more word.

So we've got good vibe.

We've got it, right.

And it's increased by one.

So it's definitely working.

So now it's tracking our score all of where all the way through perhaps I'm just going to get it wrong just to double check.

So get one wrong as well.

And then it shouldn't increase this time and it hasn't has it.

It's moved onto the next word cause I didn't get it right.

So now I just need to show some feedback right at the end of the game to say, what their school was out of 10.

So let's take a look at that.

Display the final score to the user.

I'm going to drag in another, say block.

So I go over to say, and I drag in and I'm going to do right at the bottom because this will be after the repeat is run 10 times.

And then that means that this is right at the end of the game.

So we wanted to say your score is something out of 10.

Now it can get a bit tricky now because you're looking at it this and you're thinking, well, how on earth am I going to get that value from the variable score into this block here? Because there's only one space for me to type things, but actually in Scratch, they're all ways to join text together.

And it's called concatenating the string.

That's the proper word for it.

But in Scratch, you can just use it.

This is called join and joining the two together.

So what I can do here is I can say your score is.

Okay.

Now I can't say your score is score because in the instructions it says it needs to have out of 10 on there as well.

So I can't put the variable score in there, but what I can do is I can get another join block into there, which is like, Whoa, you're blowing my mind, Rebecca.

I didn't know you could do this so I can put another joint block in there and you've got your score is, and now I can drag score in.

So where score, I'm going to try and memorise the right orange one this time.

So score and then out of 10.

Now in order for me to test this really, really quickly, I am going to put no 0.

5 seconds in all of my say blocks, just so that I can do this super quickly.

So here we go.

Quizze is starting that one I didn't change.

I say bonjour was hello? And then we've got goodbye.

And we got please.

Oops, I spelled it wrong please.

And we've got, thank you.

I need to get one wrong at least, or a few wrong.

And then how much? And then English.

So at the moment the score is six.

So it should tell me, yeah, my score out of 10 was six and that came up really, really quickly.

But you might even notice that score and out of 10 were right next to each other and that's because there's no space.

So what I can do is put a space there as well.

If I just slow that down.

You can see that now as it should be working pretty perfectly now at this point.

So let's just try it.

It's really important to test, test and test your programmes to make sure that they definitely work.

I'm going to get the last one right So your score is one act of 10.

I did brilliant on that, But now we've done everything on that list.

The only thing I'm not quite happy about with my game is that I've got at the moment, I've got the index still there on the screen and I've got the score still there on the screen and sometimes not nice really to have those things on the screen.

So if you remember from before, we've got that hide block that we can use to hide the variables.

So at the start of the game, I think what I'm going to do right up here is I'm going to hide both of those variables.

Don't just say show don't want to show I want to hide I'm going to hide the variables.

I'm going to hide index and I'm going to hide score so that they're not there.

Cause now I've tested it.

And I know that it works.

I'd say it's fine to hide them.

Okay.

Now it's hidden.

We've done it all of testing and it's all working.

And if I want to start looking at it real in the correct way now.

I can bring those subroutine calls back in as well like that.

And I could even slow the seconds down as well.

If I wanted to.

So now I've got my complete game and it's all working.

I've got these instructions.

I can pull those back in now and then I can start actually playing the game.

So we're done with the next stage is to look at maybe extending the game a little bit further if you wanted to.

So it's time for you to have a go finish it off, pause the video, to complete your task and then resume back with me when you are done.

That is so awesome I am so impressed that you've managed to do a whole translation quiz.

Let's just revisit that word again.

Decomposition.

Remember when it was just a word that you could define and now you've actually done it.

You've done some decomposition, you've broken up problem done.

And he taken it one step at a time solving each bit at a time to make it much more manageable and hopefully starting to develop that skill in yourself and you'll be able to start thinking, well, how can I break things down when I come across a huge problem in the future? Can I just not get overwhelmed and start thinking, well, where do I start? And how can I get through this? So decomposition is a fantastic skill that you can use, not just in programming, but in all sorts of things in your everyday lives as well.

So it's a really, really fantastic skill.

So you've had to go at it.

And the more you programme, the more you do these things, the better you're going to get at decomposition.

So well done I'm really really proud of you.

Now, these are some ideas for extending your translation game, and I'm not going to show you how to do this.

This is completely free choice.

I would hope that a lot of you would be able to tackle that first one, well its just to change the sprite in the background.

So you can have a look at maybe a different scene or something like that that maybe goes to translation.

So perhaps you could find an image to do with France, for example, or find a French character in your sprites or something like that to make it look part of that, that country that you were translating for, or anything else really, you could have aliens if you wanted to, it's completely up to you.

So you have a go at doing that.

And then you're the ones that they do get a little bit trickier as you go down this list.

So ask the player if they wish to play again and then let them play again.

So that's going to involve probably some kind of loop and maybe repeat until loop might help with you there.

And we were repeating until that they don't want to play anymore, for example, and it'll keep looping until they say no.

So, you can have a go at that and see if you can get that to work.

If you do try that one, it might be worth though, just saving a copy of your Scratch file.

So that you've got your original just in case something goes wrong.

It's always good practise to do that.

Save versions of your programmes as you go along and then you've got display a list of words.

So the player got wrong.

So again, this is going to be slightly more challenging because you're going to have to make an extra list.

And then as they get them wrong, you're going to have to send the word they got wrong into that new list.

So that involves quite a lot of challenging thinking, but it's something that's worth tackling.

It could be quite exciting and interesting if you had to go at that and then the final one is to allow the player to choose the language from a list of three before starting the quiz.

Now that's getting involved, the other block, remembering the translation blocks.

You've got that other one that says language.

You've got to use that word to help you solve that problem.

So see if you can have a go at tackling those.

I'd absolutely love it.

If everybody tried, tried step one, cause we should all be able to do that one and see how far you can get.

And again, please, don't worry.

It's all about breaking it down into manageable chunks.

And if you can't get there yet, you will do one day.

So don't worry at this point, but what we'd really love is if you'd like to please ask your parent or carer to share your work on Instagram or Facebook or Twitter, tagging @OakNational and #LearnwithOak.

Cause we would really really love to see what you have done to these translation programmes and how far you've got.

We'll be really impressed have you enjoyed the unit and you've got a lot out of it and we'll see you soon for another computing unit.