Watch again: Live Lesson video clips
This set of shorter video clips is taken from the Live Lesson programme and can be used to teach individual topics.
Searching
Doctor Who:
Oh. [GASPS] I'm glad you're here. Slight problem. Your funny little planet is about to be destroyed unless you can help me.
Doctor Who:
[GASPS] [BREATHES HEAVILY] The daleks have engineered a supernova that's damaged the TARDIS and now the shockwave is heading towards earth. . . . [SCREAMS]
Doctor Who:
Look. I can't fix this alone. I need your help. . . . The TARDIS is damaged. I don't know where I am. I need you to locate the TARDIS for me.
Julia Hardy:
Right, yes, you heard the Doctor. Our first mission is to locate the TARDIS. Now you're gonna do this by using the micro:bit's compass function together with a special programme that we've given you.
Iain Stirling:
Now teachers if you haven't got these done already, don't panic. There is still time. You can download the Hex file now from our website and then get your class to drag them onto the micro:bits.
Julia Hardy:
That's right. Now, while you do that, I'm gonna explain the task at hand. So it's pretty simple. Everyone, plug the battery pack into your micro:bits now.
Julia Hardy:
Now you should see a question mark starting to flash on your LED screens.
Audience:
Yes.
Julia Hardy:
Ok. Now, in a minute. Wait for it. Not yet. Not yet. Simply point and press button A to try and find the TARDIS. Now, if you find it, the message TARDIS is gonna appear on your LED screen. Pretty straightforward.
Iain Stirling:
Not yet.
Iain Stirling:
And if you don't find it, it'll just remain as a question mark.
Julia Hardy:
That's right.
Iain Stirling:
Ok, but if it's the first time you've done this with the new programme on your micro:bit, you might need to calibrate your micro:bit's compass. The instructions draw a circle will come up on the screen and you can do this by tilting your micro:bit to create a circle. The clue is in the name.
Julia Hardy:
The word circle as well. Right. So, right, are you ready to find the TARDIS?
Audience:
Yes.
Julia Hardy:
Ok, we're gonna give you a few seconds to have a go. So, are you ready? Off you go.
Julia Hardy:
See if you can find it.
Iain Stirling:
Press A. Try and find it
Iain Stirling:
Quickly, quickly, quickly, quickly, quickly, quickly, quickly!
Iain Stirling:
Time's up. Sounds simple, doesn't it, but chances are you didn't find it no matter how hard you tried and if, in the extremely unlikely event, you have stumbled upon the TARDIS, well done. However, finding it randomly is not good enough.
Julia Hardy:
No, no. You know we want you to use skills to actually find it rather than just luck because skills are for life, obviously not just for Christmas. Now we need to search for the precise location of the Doctor and the TARDIS. So we need to do a spot of computational thinking.
Iain Stirling:
And to help us guide and to help guide us, reading out loud's hard.
Julia Hardy:
It is, isn't it? It's a tough day for you, Iain.
Iain Stirling:
Sorry everyone. And to help guide us, we've got a very special guest from the biggest internet search company on the planet. Please welcome from Google, it's Google and engineer, Laura Lowenthal, everybody. [APPLAUSE]
Iain Stirling:
Come on, she's from Google everyone!
Julia Hardy:
Hi!
Laura Lowenthal:
Hiya.
Iain Stirling:
Laura, Laura lovely to have you with us. Are you having a lovely day so far?
Laura Lowenthal:
Thank you.
Laura Lowenthal:
Lovely day.
Iain Stirling:
I'm glad to hear it. So you're an engineer so you must know a thing or too about computers. So what is it about computers and computer science that you found so interesting growing up?
Laura Lowenthal:
Well, ever since school I've really enjoyed solving puzzles and math problems and that's exactly the kind of skills that you need for computer science. See, computer science is all about getting real work problems and framing them in ways that computers can understand and help you solve.
Laura Lowenthal:
So since real work problems are always changing, the job itself always changing and it never gets boring.
Julia Hardy:
Oh, wow. Ok, so I think everyone here knows how to use Google. I mean, yeah, it's so commonly used that even the verb to google is now in the English dictionary. Obviously, you know, you type in what you want and then you find it. It all sounds very, very straightforward but how does actually the search programme work within that?
Laura Lowenthal:
Well Google has an index of all the web pages there are available publicly.
Julia Hardy:
All of them?
Laura Lowenthal:
Online. All of them.
Julia Hardy:
[SIGHS]
Laura Lowenthal:
Well . . . All that are available online. . . . So it works like an index at the back of a book where alphabetically you can find what pages contain the information that you are looking for. So, when you type in your search, say you type in Doctor Who: , Google has quick access to that index and has all the relevant pages that contain information about Doctor Who: . But that can be hundreds, thousands, millions of pages.
Laura Lowenthal:
So Google needs still to narrow it down to whatever's relevant for you. For example, when you're searching for Doctor Who: , you are probably interested in the Doctor Who: website or maybe some news about Doctor Who: , but certainly not in a page who lists the question, who is a doctor, a hundred times.
Iain Stirling:
Not interested in that.
Julia Hardy:
It's a really boring website if you've been there.
Laura Lowenthal:
Right. So to do that, Google will take some clues like whether Doctor Who: is on the title of a page or how fresh the content is or whether it's in a location that's close to you to show you what is most relevant to you.
Julia Hardy:
Ah, ok. A lot of things to think about.
Iain Stirling:
Yes, there's a lot to do with narrowing down a search. That seems to be the most complicated bit. So, how are computers narrowing down this search so we can find what we're actually looking for?
Laura Lowenthal:
Well, actually the journey started way before you typed in your search. . . . To build that index Google uses software called crawlers that start with a few web pages in the web and start clicking and following links like you would do if you were to browse all over the internet. So as you move along, you gather the information of each of the page and store it in the index for quick access later. So the index ends up being pretty big, about hundred million gigabytes.
Julia Hardy:
Google's, kind of, done it's homework ahead of time. It's found out where it needs to go before it needs to go there. Is that, kind of, right?
Laura Lowenthal:
That's right.
Iain Stirling:
A hundred million gigabytes.
Laura Lowenthal:
Yeah.
Iain Stirling:
That's like 800 million Ed Sheeran albums everyone.
Julia Hardy:
That's a lot of emotions all in one place.
Iain Stirling:
So where are all these index stored?
Laura Lowenthal:
They are stored in data centres across the world. So Google keeps this information replicated, which means it keeps several copies of it just in case so that your information reaches you fastest by being closest to you.
Julia Hardy:
Ah, ok. So searching, you know, using a search engine is clearly a complex operation underneath it all, but today to understand the basics we're just gonna focus on a couple of very simple search algorithms. So first of all, I guess we need to define what is a search algorithm before we go any further.
Laura Lowenthal:
Right. So an algorithm is simply a sequence of steps that you take to reach a certain result. So a recipe for a cake, for example, that is an algorithm.
Julia Hardy:
[INTAKES BREATH] A delicious algorithm.
Laura Lowenthal:
Yeah. An algorithm to reach a cake. So a search algorithm would be a sequence of steps to find something that you're looking for amongst a big collection of items or things, like finding your favourite book in a big book shelf. There are different kinds of search algorithms and each has its advantages and disadvantages; how simple it is to write, how fast it runs a computer or how many resources it consumes.
Julia Hardy:
Mmm. Ok.
Iain Stirling:
Right, cool. So, unfortunately, we cannot Google the TARDIS today to find out where it is.
Julia Hardy:
Why not?
Iain Stirling:
Because that would be boring. So what we're gonna have to do is look at how two of the most basic search algorithms work. We're gonna look at linear search and binary search. Here is a video about both of those things now on this screen.
Narrator:
To perform any search you need to know what you're looking for, your search term. In this case, a needle, and where to look for it, the list of items it's hidden in. In this case, a haystack. Now imagine each thing in that list is lined up one by one and given a number, that number is known as its index. But let's face it, computers don't look for needles in haystacks, so to make our search algorithms easier to understand, let's make the elements in our list numbers and 15 is the number we're looking for. A linear search algorithm basically go through all of the elements one by one looking for a match, which could take a while, or we could use a binary search algorithm, which uses the computer's ability to order elements in a list, in this case from low to high numbers. First the algorithm finds the mid-point of the list, index three. It then checks if the search value is higher or lower than the element in index three. If it's higher, everything lower than index three is discarded. If it's lower, everything higher than index three is discarded. Index three is now the end point and the new mid-point is one. It performs the check again and goes on performing the check until we find the search term. The computer has now found your needle.
Julia Hardy:
Ok. Using what we've just learnt, we're gonna use one of these search algorithms to locate the TARDIS' position. So you can do this in your classrooms as well, and teachers do refer to activity sheet one for all the info.
Iain Stirling:
Ok, so it's on the list. We are using a compass, which is numbered from zero to 360 degrees because that is how a compass works, everyone.
Julia Hardy:
Thanks for that, Iain.
Iain Stirling:
You're welcome.
Julia Hardy:
Teachers, you can join in if you wish by finding the bearing of magnetic north in your classrooms. For here in the black archives, north is in this direction.
Iain Stirling:
Scotland's that way everyone.
Julia Hardy:
Come on everybody. Now, to complete the search we'll need six volunteers to take their place on our compass. Hi, guys. Come on in. Now each volunteer has a special micro:bit torch with them to help us locate the TARDIS. So when they find it, the message TARDIS will appear on their micro:bit screens.
Iain Stirling:
So Laura, if we were to perform a linear search to find the TARDIS, how would we go about doing this? Talk me through it.
Laura Lowenthal:
Ok. Well, as we've just seen, the computer would go one element of the list at a time, or in this case would go from degree zero to 360 one at a time and see if they match our search term, which is, in this case, the TARDIS. So let's start by checking position zero.
Iain Stirling:
This is it. Zico, we want you to put in zero and then press the button.
Iain Stirling:
A question mark or TARDIS?
Zico:
Question mark.
Iain Stirling:
It's a question mark. It's not there, Laura.
Laura Lowenthal:
That means that the TARDIS isn't there, that we need to move on to the next position.
Iain Stirling:
Ok, Zico could you move out to ten.
Laura Lowenthal:
Let's skip ten.
Iain Stirling:
Press it again, mate.
Iain Stirling:
A question mark or TARDIS?
Zico:
Question mark.
Iain Stirling:
Question mark again.
Julia Hardy:
So, right, if the TARDIS is over there, this is gonna take absolutely forever.
Laura Lowenthal:
We'll check 320, 330, 340 . . .
Iain Stirling:
Alright, ok, how about, listen, listen, listen, listen to me. How about we do a binary search. Would that work?
Julia Hardy:
Would that be quicker?
Laura Lowenthal:
Yes, I think a binary search would work better.
Iain Stirling:
So how do we do that? [LAUGHS]
Laura Lowenthal:
Well, the way a computer would do this is we find the mid-point between the first and the last element of the list or, in this case, our degrees. So the mid-point between zero and 360.
Julia Hardy:
Which is, of course, 180, right?
Julia and Iain:
180!
Laura Lowenthal:
Exactly. So let's go all the way there.
Iain Stirling:
Wicked. Ok.
Iain Stirling:
Hello also, Lucas. You're 180. How does that make you feel?
Lucas:
Happy.
Iain Stirling:
Good. He loves it.
Julia Hardy:
He loves it. Right, ok.
Laura Lowenthal:
So if you want to point your torch exactly at the 180 line and press button B.
Julia and Iain:
What's it say?
Lucas:
Higher.
Iain Stirling:
Higher.
Julia Hardy:
Ah, ok. So that means that the TARDIS is somewhere on this side here.
Laura Lowenthal:
It's higher than 180. So what the computer will do now is disregard everything that is below 180.
Iain Stirling:
Ok, if you two could just go over there. Thank you so much for your help.
Julia Hardy:
So, already within one search we've basically eliminated half.
Laura Lowenthal:
Yes. Exactly.
Julia Hardy:
That's quicker.
Laura Lowenthal:
So 180 becomes our new starting point and we start all over again. We find the mid-point between 180 and 360.
Julia Hardy:
Which is 270 maths?
Laura Lowenthal:
Thank you. Yes. So Dylan over there, if you want to step on the red line that's 270. Point your torch there, press button B.
Iain Stirling:
What's it say, big man?
Dylan:
Lower.
Iain Stirling:
Lower.
Julia Hardy:
Ah, ok. So that means everyone standing on that side now needs to go 'cause we know that the TARDIS is somewhere between 270 and 180.
Laura Lowenthal:
That's what a computer would do. Disregard everything that is higher than 270.
Julia Hardy:
Ok.
Laura Lowenthal:
And 270 becomes our new end point. So now we have to find the mid-point between 180 and 270.
Julia Hardy:
Which is 225.
Laura Lowenthal:
Oh, thank you. You're so good with maths.
Iain Stirling:
Dylan, get in the little red line. Good man. You're smashing this.
Laura Lowenthal:
Press button.
Iain Stirling:
Give you a little squeeze, tell me what you see.
Dylan:
Lower.
Iain Stirling:
Lower.
Laura Lowenthal:
Ok. So 225 becomes our new end point. Thank you, Dylan.
Julia Hardy:
So, Lucas you're the only man standing. Now we need to find the mid-point between here.
Laura Lowenthal:
Right and we've really narrowed this down. It only took us how many? Three steps.
Laura Lowenthal:
And we already know that it's in this region.
Julia Hardy:
So the TARDIS is literally somewhere here. Ok, right. So I think we're gonna go to 202.5. So that line there.
Iain Stirling:
Why 202.50?
Laura Lowenthal:
Because that's the mid-point between 180 and 225. Have you been paying attention?
Iain Stirling:
I'm very confused. [SIGHS]
Laura Lowenthal:
Alright, so if you point your torch to 202.50.
Julia Hardy:
What's it say?
Lucas:
TARDIS.
Julia Hardy:
It says TARDIS! We've found it.
Iain Stirling:
We've found the TARDIS.
Iain Stirling:
I did not think that was gonna work. Amazing.
Iain Stirling:
We've done it. Ok, now using binary search we have precise located the TARDIS in four simple steps. We now need to work out which direction the TARDIS is in, but to completely stabilise it we need everyone here and around the UK, so even in schools as well, to find it. I'm gonna go and show the audience what direction they need to be facing. So everyone stand up, please. Everyone stand up.
Julia Hardy:
Everyone face towards Iain. Now here in the studio are you all facing towards Iain?
Iain Stirling:
A little bit to your left. Everyone, sort of, in a line like this.
Julia Hardy:
Ok, now everyone around the UK all together we're gonna press button B and it'll say higher or lower to tell you if the TARDIS is further to your right or to you left, and then you can use it to help you find it. So, are you ready everybody. Off you go, press button B.
Iain Stirling:
Hit B and go left and right and try and get it right.
Iain Stirling:
Go left and right.
Iain Stirling:
Come on, guys. I believe in you.
Iain Stirling:
I've done it. I've done it. I've got it. We've got it. We've done it. Listen, [UNSURE OF WORD] thinking is in override. You've used your binary search and succeeded an intergalactic identification of the lost target. Julia, how do you feel?
Julia Hardy:
I feel fantastic. That was really cool actually, and if you wanna know more about how the code and the compass on the micro:bit works have a look at worksheet two on our website.
Searching
Explore search algorithms and help located the TARDIS with our expert guest Laura Lowenthal from Google.
Please note that this resource was developed in 2016 and some of the links to the previous micro:bit code editors on the original printed resources may no longer work. We have removed the links to the hex files, but a number of the code projects on the activity sheets can be replicated using the new MakeCode editor available on micro:bit.org, so these sheets are still available for your information.
Debugging
Dr Who:
Good news. You've located the TARDIS. You're getting the hang of this. Now, I need you to use your micro:bits to get the TARDIS back online. No pressure. Just your planet at stake. I know you can do it.
Julia Hardy:
No pressure. This mission is far from over.
Dalek:
Data transmission intercepted. Data transmission intercepted. You communicated with the Doctor. Explain. Explain.
Iain Stirling:
Mate, we're just watching a bit of TV, waiting for you to end the world, buddy. Don't stress about it.
Dalek:
The shockwave's trapped. The shockwave remains on course for imminent impact with earth. No one in the universe can stop the daleks.
Julia Hardy:
I thought we've heard this line a little bit before. Your system's starting to glitch, mate.
Dalek:
The Doctor is an enemy of the daleks. You are an enemy of the daleks. You failed to obey. Prepare to be exter, extermi-nated. Contact related, exfoliated, system failure. System failure! System failure!
Julia Hardy:
Sshh. Sorry, did I just hear him right, was he talking about exfoliation, because my skincare regime is flawless, alright. Anyway, back to it. So now what we know is at stake here, the daleks are still on course to destroy the earth with a supernova.
Iain Stirling:
Do you mean that star suddenly greatly increases in brightness because a catastrophic explosion ejects most of its mass?
Julia Hardy:
Yeah, that.
Iain Stirling:
Thank you Wikipedia.
Julia Hardy:
[LAUGHING] Yeah. So we found the TARDIS, but we do still need to fix her. Fixing things that go wrong in a computer programme is part of a very important skill in computer science, commonly known as debugging.
Iain Stirling:
And to help us understand what debugging is, we have got another super expert. Two in the space of five minutes. You are all welcome. He knows all about debugging. He has worked on games such as Just Dance and works with one of the biggest computer companies in the world. Please welcome, from Ubisoft Reflections, it's Sam Adamson: everyone. [APPLAUSE]
Iain Stirling:
[INAUDIBLE]. Hi, you alright?
Julia Hardy:
Hi Sam, how are you doing? Ok . . . Sam, we haven't got an awful lot of time to waste, so let's cut to the chase. What exactly is debugging?
Sam Adamson:
So, in the video games industry, we actually have whole teams dedicated to games testing and we call these quality assurance or QA, and what we're doing when we're testers, we're gonna play through the games and find all the defects in the software that we can and we call these bugs. Debugging itself is actually finding and fixing these issues.
Julia Hardy:
Ah, ok.
Iain Stirling:
Ah, wait, wait, hang on. Your job is, correct me if I'm wrong, you play computer games all day?
Julia Hardy:
And get paid?
Sam Adamson:
And we get paid for it. Yes.
Julia Hardy:
What?
Sam Adamson:
But it's actually a lot more technical than what people think.
Iain Stirling:
Is it, Sam? Is it?
Sam Adamson:
It really is. It genuinely is.
Iain Stirling:
What do you have to do? What's so tricky?
Sam Adamson:
So, we need people who are very good with computing and they need to be very analytical and they also need very good communication skills and what we're doing is we're playing the same part of a game over and over again trying to find as many defects as we can. And then we're gonna report those to developers, and they're gonna fix those issues and then we can retest them after that.
Julia Hardy:
Sounds a little bit less fun. So what kind of bugs do you usually find in video games, for example?
Sam Adamson:
So in the early stages, we specially get a lot of different issues. So we get a lot of art issues. We got a lot of animation issues.
Julia Hardy:
Levitating. Sometimes my head is in a wall and I don't know why it's there.
Sam Adamson:
Yes, so characters sometimes they'll fly across the map and things like that, and we also get more critical errors, which'll be when the game crashes, which obviously we don't want for any players at all.
Julia Hardy:
That's the worst one.
Sam Adamson:
Yeah.
Julia Hardy:
Yeah.
Iain Stirling:
Ok, well it sounds like the TARDIS might have a bug or two. So, in order to fix her, we are going to get her back online. We're gonna find and identify three common kinds of error that you can find in computer programmes. They are, and I know these guys so don't panic. They are syntax error, run time error and logic error.
Sam Adamson:
That is the three.
Iain Stirling:
Here's a little video now.
Narrator:
There are many different types of error that can occur in a computer programme, and here are just a few of them.
Narrator:
Syntax errors happen when the wrong spelling or grammar's used in the programming language you're working with. A programming typo. This could be as simple as using the wrong bracket, misspelling an instruction or using a capital letter in the wrong place. A run time error is often caused when the computer's asked to do something that it can't actually do and it hits a wall, metaphorically, of course. There are lots of reasons why this could happen. For example, we know that computers perform algorithms in order and like following a recipe. So, if your instructions are accidentally written in the wrong order, this could mean that the computer's looking for something that doesn't exist yet, causing a run time error, or you could simply be asking the computer to do the impossible. Lastly, a logic error is where the programme manages to run successfully but doesn't do what you expect it to. Usually this is because you've written an instruction thinking it will do one thing but, turns out, it does something else. The computer thinks it's doing a perfect job, but the results can get a little weird. Syntax errors, run time errors and logic errors. Do you know the difference?
Iain Stirling:
I don't know the differences yet, but I think there are a few other errors round here apart from computer errors, if you know what I mean. I mean daleks.
Julia Hardy:
Don't look at me.
Julia Hardy:
Don't look at me when you say that.
Dalek:
Daleks are not errors. Daleks are the superior life form of the universe.
Julia Hardy:
Wow, their hearing's . . .
Iain Stirling:
They've got superior hearing, I'll give them that.
Julia Hardy:
Yeah.
Iain Stirling:
Ok, everyone out there in the classrooms at home, it's time for our next challenge. You will need activity sheet three. Get it ready now.
Julia Hardy:
Ok, your task is to identify the bugs in our programme and get the TARDIS back online.
Iain Stirling:
On your activity sheet you will see a few lines of code written in MicroPython, which some of you, I'm sure, will be familiar with. Like me.
Julia Hardy:
Now, this code [LAUGHING] should connect us and allow us to plot the heart of the TARDIS on the LEDs on our gigabit, which is a supersize micro:bit that we've got right here. So, within the code there's one syntax error, one logic error and one run time error. Now, your mission is to correctly identify those errors.
Iain Stirling:
And do not worry even if you're not familiar with MicroPython, you might be able to spot some of those errors straight away. Once you've fixed those bugs, a smiley face should appear on our gigabit, right, and we should see the heart of the TARDIS, in theory, start again. No pressure, but if you don't restart the TARDIS, the Doctor's had it, basically.
Julia Hardy:
It's a lot of no pressure, pressure situations here. Anyway, teachers send your students' answers in and we could be using them to help fix the TARDIS. So details are on the screen below.
Iain Stirling:
Send them in quickly, please. Send them in very qu . . .
Julia Hardy:
Yes, do.
Dalek:
TARDIS data link detected. Weapon systems re-initiating in 60 seconds.
Julia Hardy:
Oh, 60.
Iain Stirling:
You've heard the dalek, everyone in the room and everyone at home, you have got 60 seconds to identify your three errors. Go, go, go! Julia, make sure they're doing it properly.
Iain Stirling:
60 seconds. Find those errors.
Dalek:
You will not fix the TARDIS. You are an inferior species.
Julia Hardy:
Here's Andre. Hi, Andre. How are you doing?
Iain Stirling:
A mere 60 seconds, guys.
Iain Stirling:
You can achieve a lot in 60 seconds, but can you identify . . .
Dalek:
You will not succeed. You are inferior, inferior.
Iain Stirling:
Data errors.
Iain Stirling:
Hurry, hurry, hurry, hurry!
Dalek:
20 seconds left.
Dalek:
You are inferior. You will not succeed.
Dalek:
Prepare to be elim, elim, exfoliated, laminated, system failure, my communication is impaired, system shutting down.
Julia Hardy:
Ooh.
Iain Stirling:
Ok, I think we might be witnessing a run time error from the dalek there. So get your answers sent in if you're at home. Teachers get online and get those failures sent in, but right now, Julia, I believe our audience have got some possible errors for us.
Julia Hardy:
Yes. So, I'm here with Andre. Hi, Andre. How are you doing?
Andre:
I'm alright. Yeah.
Julia Hardy:
And have you found one of the errors for us?
Andre:
Yeah, there's a syntax error over here. So it's missing a bracket there.
Julia Hardy:
And which line is that on?
Andre:
It's on line
Julia Hardy:
Well, just say what it says.
Andre:
Sleep, open bracket, 1000 and it's missing the closed bracket.
Julia Hardy:
Ah, so, Sam, is that correct? Is that a syntax error that he's found?
Sam Adamson:
Yes, Andre, that's absolutely perfect. As you can see on the line, cos we're calling the sleep, we need the parentheses to be finished. So, there should have been another bracket on the end of that line.
Julia Hardy:
Ah, ok. So well done, well done, Andre. Great stuff.
Iain Stirling:
Ok, before this guy kicks back up, let's go through the other two errors we had as well. So we had a logic error. Can you talk us through the logic error please, Sam?
Sam Adamson:
The logic error's the very last line of the page and, as you can see, it's gonna show an 'Image.SAD' and what we really want is a happy face to be displayed.
Iain Stirling:
We want everyone to be happy, guys. Love thy neighbour, you know. Yeah, and finally, we've got one more error to go through. Sam, if you could talk us through that as well that'd be great.
Sam Adamson:
Yeah, so the run time error is because here we're gonna ask the computer to divide by zero, and you cannot do that. So it's gonna crash as we run.
Iain Stirling:
You can't divide by zero. Right, so we have correctly identified and classified all of our errors in the gigabit. Let's see if it's connected to the TARDIS correctly. It should be. Yeah. Look. It's a smiley face. We have debugged the TARDIS. We are back online.
Dalek:
You may have repaired the TARDIS but you will not save earth. The shockwave will exterminate your species. You have failed. Daleks reign supreme.
Debugging
Find out all about debugging and help fix the TARDIS with our QA expert from Ubisoft.
Your class will need this downloadable activity sheet:
Common components in an algorithm
Peter Capaldi/Doctor Who:
Oh, good job you lot! You've got the TARDIS back online. But now I need you back in your micro bits. It's time to stop a supernova.
Julia Hardy:
I forgot about the supernova!
Iain Stirling:
A star that suddenly increases greatly in brightness because of a [INAUDIBLE] most of its mass?
Julia Hardy:
Yes! Anyway, the shockwave from the supernova is heading our way and we need to find a way to repel it!
Iain Stirling:
To do this, we're gonna have to use the combined force of the microbits to generate the energy field large enough to overpower the shockwave.
Julia Hardy:
To harness that energy–oh, no I don't need need to shout this bit, okay, yeah. We're gonna need to repel the shockwave programs on our microbits. So teachers, if you haven't got these yet there's still time to do it. Download the HEX file from our website and get your students to drag them onto their microbits.
Iain Stirling:
Microbits!
Julia Hardy:
Oh.
Iain Stirling:
We're out of duh, duh, duhs.
Julia Hardy:
We've spent all the budget.
Iain Stirling:
No money left. No more duh, duh, duhs? Mr Camera man?
Julia Hardy:
No. No.
Iain Stirling:
Wicked, thank you.
Julia Hardy:
Anyway. So what we need you to do in a minute is to shake your microbit, and each time you shake it the LED's are gonna get a little bit brighter. And when it hits the right point, the LED's will flash at full brightness, and we'll have created the perfect light energy frequency to repel the shockwave.
Iain Stirling:
Okay. But don't do it just yet. Stop–I can see a few of you shaking.
Julia Hardy:
Stop shaking!
Iain Stirling:
I will come there and unshake you straight away. Okay, we'll need to do it altogether. We all need to combine as one and shake together to harness the right level of power. This sounds like one of the most epic games of all times.
Julia Hardy:
Well yes. And speaking of games, we'll have another super guest to help us walk around–
Iain Stirling:
A third super guest? Unbelievable.
Julia Hardy:
Yeah, I know. And he can somersault. In other words, kind of you know, wheel around the analog stick and press button X through the wibbly wobbly timey wimey challenge ahead.
Iain Stirling:
Okay. This next guest, she was named one of the top a hundred most influential women in the games industry, that's a fact. She has been a judge on the BAFTA games award, that's another fact. She once raised so much money for a company, they bought three helicopters. That's a fact. She has worked on console and PC games from Atari to Midway. That's your fourth fact. And she is the deputy-head of Teeside University's computer games department. Gabrielle Kent: everybody!
Julia Hardy:
You got some cheers for the helicopters there, I think.
Gabrielle Kent:
Oh, I doubt it.
Iain Stirling:
Three helicopters worth of money. Incredible.
Julia Hardy:
There you go. So Gabrielle, tell us, as someone who's obviously worked in the video games industry. I mean, how important do you think it is for people to have kind of like, core basic programming skills. Is it worth doing, is it worth learning?
Gabrielle Kent:
Absolutely. So programming is a core part of games development, so without the programmers we just have pretty graphics that don't really do anything. So the programmers also create what we call the games engine, so that's the software that actually makes the game run. So I work more in the art and design side of games, so while you don't need programming skills to be a games artist, it's really useful for game designers to have at least a working knowledge of game scripting.
Julia Hardy:
Okay.
Iain Stirling:
Okay so what are the sort of key elements that go into programs? Like, what are the components that are used in games, when it comes to programming?
Gabrielle Kent:
So we have inputs–
Julia Hardy:
Okay.
Gabrielle Kent:
That's information that the computer receives, and outputs. That's information that the computer sends out.
Julia Hardy:
Okay.
Gabrielle Kent:
So, in a game–
Julia Hardy:
And what's an input?
Gabrielle Kent:
For example, if a games controller, when you press a button on your games controller, that's–
Julia Hardy:
That's an input.
Gabrielle Kent:
Yep. That's inputting information into the program, and when the character on your screen jumps, that's when it's outputting.
Julia Hardy:
Okay. I see. That's really interesting. And often we hear the term variable, like, used quite a lot. But I don't know if I really fully understand what it means. What is a variable?
Gabrielle Kent:
So a variable is you now, what the program uses to store, access and change information.
Julia Hardy:
Okay.
Gabrielle Kent:
So it works in a similar way to algebra. Where X for example represents a number. So in games, your score is a variable. So as you progress through the game the program accesses your score and it adds to it if you're doing well in the game, thus increasing it. So your score gets higher.
Iain Stirling:
Lovely. And Gabrielle yesterday I went to a library for twelve hours and read books all day. And one of the words I read was conditional statements. What does that mean?
Gabrielle Kent:
So conditional statements are used when we want the program to make a selection or a choice. So they tell the computer you know, what choice to make and when. For example, if your score is high enough, then you've won the game. If your score isn't high enough, then you've lost. So those are conditional statements.
Julia Hardy:
So if it does this, then you do that. So this has to be met before we can move on to the next bit otherwise it just kind of stops. Right, okay. So we'll show you how to use the repelling the shockwave program works on our microbit, we're gonna demonstrate how the components that Gabrielle's just described, the inputs, variables, instructions, conditional statements and outputs operate together so that the LED's on your microbit light up. And for that, we need four volunteers. So come in. And classrooms, if you want to know how this program works take a look at activity sheet four.
Iain Stirling:
Okay. Right. Thank you very much guys.
Julia Hardy:
Oh, you are very good at wheeling that. There we go. Hi guys. Hi guys.
Iain Stirling:
Gabrielle. Can you please explain to me, because I have no idea what's happening here, how this works using our lovely volunteers.
Gabrielle Kent:
Yep. Okay, so on the end we have Kofi who represents our input.
Iain Stirling:
Our microbit, essentially.
Gabrielle Kent:
Exactly. And we have Holly who represents our instruction. We have Connor who is our conditional statement, and Believe who is our output. And then in the middle here we have our variable, which is brightness, in this case.
Julia Hardy:
Okay. Right.
Gabrielle Kent:
So. When we receive an input, so for example Kofi, when you shake your microbit.
Julia Hardy:
Shake your microbit!
Iain Stirling:
Give it a shake. Right, that's nice. It's warm in here, actually mate. Keep going. That is lovely stuff. Okay.
Gabrielle Kent:
And the result of that input is that our instruction adds twenty to brightness.
Julia Hardy:
So, if it shakes then put in a twenty of brightness. So if you have a look here, that's twenty of brightness. And then what does Connor have to do?
Gabrielle Kent:
So the conditional statement, then, we'll check to see if the variable is equal to or higher than two hundred and forty which is the condition that we've set.
Julia Hardy:
Okay. So is it higher than two hundred and forty, Connor?
Connor:
No.
Iain Stirling:
How much is it, Connor?
Connor:
Twenty.
Iain Stirling:
You're the cleverest boy in all of Manchester.
Julia Hardy:
There we go. So then, but that, it stops here right? The conversation stops here, it doesn't move any further on because obviously Connor isn't happy. He hasn't got his two hundred and forty, he will not talk to Believe. Not gonna have any kind of conversation at all until he's got his two hundred and forty.
Gabrielle Kent:
Yes, exactly. So if we'd hit two hundred and forty, then Connor would pass on the information to our output, and then our output, the LED's would flash, would light up and flash at full brightness to show that the condition has been met. But because it hasn't, everything's going–
Julia Hardy:
So the lights were off.
Gabrielle Kent:
Yep. It's gonna remain the same, and–
Julia Hardy:
And then nothing happens until obviously you do another new input, right?
Gabrielle Kent:
Exactly. Until we have that input again.
Iain Stirling:
So we have the input again. Shake it, carry on mate. Yep, yep, yep, yep, yep. Lovely stuff, okay.
Julia Hardy:
And then we add in. That's it.
Julia Hardy:
Connor. Connor, are you happy? Do you have your two hundred and forty that you need?
Connor:
No.
Iain Stirling:
Connor, what's wrong with you? Right this is taking too long, I can't, I can't. There we go.
Julia Hardy:
There we go. Let's just put them all in. There we go.
Iain Stirling:
There you go.
Julia Hardy:
Connor, are you finally happy? Is there more than two hundred and forty in there?
Connor:
Yeah.
Iain Stirling:
Connor's happy everyone!
Julia Hardy:
So you need to let Believe know that she can now, obviously, turn on the light.
Connor:
Turn on the light!
Julia Hardy:
Turn on the light! There we go.
Gabrielle Kent:
So our condition has been met, and the LED's are not on full brightness. So yep, we've achieved our aims.
Julia Hardy:
And of course, if we'd done this with the microbit we would have reached the optimum level, lit all of the LED's and stopped the shockwave.
Gabrielle Kent:
Exactly. We would have.
Julia Hardy:
Right! Okay.
Iain Stirling:
What are we waiting for? Everyone, get your microbit at the ready. That's you in your classrooms as well, get your microbits out. And in a minute, so not yet we want you to shake your microbits until you hit the right frequency and all of the LED's light up. So guys make your way to your microbits. Make your way, make your way.
Julia Hardy:
So if you guys, if you get back to the panel. Give me that, there you go. So yeah, hook up your microbits to the mini console there. So everyone's gonna have to do this at the same time. So only when everyone across the UK has reached their optimum light levels their microbit is fully lit and the mini console is fully lit, will the super nova shockwave be stopped. This is what's happening, this is the reality of our life, Iain.
Iain Stirling:
Okay but the problem is we have only got, and listen very carefully. We have got thirty seconds to get our microbits fully lit. So you must start shaking yourself away for thirty seconds starting now. Go!
Julia Hardy:
Go, go, go. Shake, shake, shake, shake, shake, shake, shake, shake!
Iain Stirling:
Get it up! Get it lit!
Julia Hardy:
Shake it! Shake it!
Iain Stirling:
Get it lit!
Julia Hardy:
Do it!
Iain Stirling:
Stand up! Stand up and shake it! [SCREAMS]
Julia Hardy:
Come on!
Iain Stirling:
Shake it!
Iain Stirling:
Wait, wait, wait. The UK microbits are lit. The console's lit! We are at full brightness, everybody!
Julia Hardy:
Well done! It's very hot in here now.
Peter Capaldi/Doctor Who:
You did it! You've stopped the shockwave and saved the Earth from the daleks. Those microbits, they can do more than you think. And so can you. Right, I need to pick up [UNSURE OF WORD]. Thanks again.
Common components in an algorithm
Explore inputs, outputs, variables, conditions and instructions with our games expert, Gabrielle Kent.
Please note that this resource was developed in 2016 and some of the links to the previous micro:bit code editors on the original printed resources may no longer work. We have removed the links to the hex files, but a number of the code projects on the activity sheets can be replicated using the new MakeCode editor available on micro:bit.org, so these sheets are still available for your information.
Linear and binary search
Narrator:
To perform any search, you need to know what you're looking for, your search term. In this case, a needle and where to look for it, the list of items it's hidden in, in this case a haystack. Now, imagine each thing in that list is lined up one by one and given a number. That number is known as its index. But let's face it, computers don't look for needles in haystacks, so to make our searchalgorithms easier to understand, let's make the elements in our list numbers. And 15 is the number we're looking for. A linear search algorithm basically goes through all of the elements one by one looking for a match, which could take a while. Or, we could use a binary search algorithm which uses the computer's ability to order elements in a list, in this case from low to highnumbers. First, the algorithm finds the midpoint of the list, index 3. It then checks if the search value is higher or lower than the element in index 3. If it's higher, everything lower than index 3 is discarded. If it's lower, everything higher than index 3 is discarded. Index 3 is now the end point and the new mid point is one. It performs the check again and goes on performing thecheck until we find the search term. The computer has now found your needle.
Linear and binary search
Learn all about linear and binary search algorithms in this quick animation.
Different types of error
Narrator:
There are many different types of error that can occur in a computer program, and here are just a few of them. Syntax errors happen when the wrong spelling or grammar is used in the programming language you're working with. A programming typo. This could be as simple as using the wrong bracket, misspelling an instruction or using a capital letter in the wrong place.A run time error is often caused when the computer is asked to do something that it can't actually do and it hits a wall. Metaphorically, of course. There are lots of reasons why this could happen. For example, we know that computers perform algorithms in order, like following a recipe. So if your instructions are accidentally written in the wrong order, this could mean that the computer'slooking for something that doesn't exist yet, causing a run time error. Or you could simply be asking the computer to do the impossible. Lastly, a logic error is where the program manages to run successfully, but doesn't do what you expect it to. Usually this is because you've written an instruction thinking it will do one thing, but turns out it does something else. The computer thinks it'sdoing a perfect job, but the results can get a little weird. Syntax errors, run time errors and logic errors. Do you know the difference?
Different types of error
Find out about syntax, run time and logic errors in this short animation.
Your questions answered
Julia Hardy:
Hi! So we didn't get to answer all of your questions in the live lesson, so we've asked Laura, Sam and Gabrielle if they could answer a few now. So why don't we get the first question up on the screen! So "who or what inspired you to make games?" And that's from Pendle Vale College in Nelson and St John's international school in Sidmouth. So, what inspired you?
Gabrielle Kent:
So when I was at University, we found out there was a games studio quite close by. And I got to do a work experience there–
Julia Hardy:
Did you just rock up and be like, hey!
Gabrielle Kent:
Yeah. I did actually at first, and then I had to do a proper application. But I got to spend the entire summer there. So drawing monsters and zombie priestesses. And that, from then on I thought, you can get paid to do this? So that's what I'm gonna do with the rest of my life.
Julia Hardy:
Who or what inspired you to make games?
Sam Adamson:
So what inspired me to make games really was just playing them all the time. All the different types of games that you could have. I wanted to be surrounded by so many creative people in our industry. Which, you know, it's such a passionate industry as well. And followed by many gamers.
Julia Hardy:
And also it's quite different now as well in that gaming always seemed quite like, quite hard to get into. Or you'd never meet anyone. But actually now with kind of social media, you can actually reach out to the people who make the games that you love and actually you know, be a bit cheeky. Maybe ask for a little bit of work experience. It can't hurt. It can't hurt.
Gabrielle Kent:
Absolutely. And like developers are really open to chatting with the fans as well. And there's a lot of courses now that will teach you how to make games.
Julia Hardy:
So, all to play for. So, next question. "How long did it take Google to develop the code for searching the internet?" and that's from Luke from Formby high school. So that's quite a hard one to answer because obviously it's constantly adapting now, so since the beginning?
Laura Lowenthal:
So that's the thing. So the initial algorithm that just two people came up with in their garage when they were just finishing University back in the nineties. I don't know how long it took them to get that out, but after that, that was called the [UNSURE OF WORD] algorithm. And after that, the algorithms started growing and evolving, and things that Google can do right now like, guess what your question is going to be before you even ask it.
Julia Hardy:
Oh, like when you type in and it comes up with the–
Laura Lowenthal:
The auto complete or the cards that just answer in specifically the questions that you've got from different sites of the web. All that came after, so it's constantly evolving and I would hope it continues to evolve.
Julia Hardy:
So just it's constantly changing, it's never been like, it's not like oh, we've indexed the internet! We're finished now! Doesn't really work that way does it? Okay, what's the next question. "If you weren't a computer programmer, what would you be?" And that's from Freya from Formby high school. So what would you be doing?
Laura Lowenthal:
Well, that's a tough one. I also like languages a lot. Like not programming languages, but real communication languages. So I fantasised a couple of times about also becoming an interpreter. A language interpreter.
Julia Hardy:
Oh, that would be fun!
Gabrielle Kent:
You can do that for games as well!
Laura Lowenthal:
I can. I speak four languages, so. Counting.
Julia Hardy:
Fancy. I can barely speak one. Now, what's the next question? So, "who develops music for video games?" and that's from Dan from Formby high school. So that's quite a big question.
Gabrielle Kent:
It is. So some studios will have an in-house audio person that creates, it's not just the music, it's the sound effects as well. So the sound of footsteps, the sound of running, the sound of panting. They'll also record over the dialogue as well. But there's some composers absolutely specialising in music for games. Like Austin Wintory. So he did the music for the game Journey and he was nominated for a Grammy for that as well.
Julia Hardy:
Journey music was amazing.
Gabrielle Kent:
Beautiful.
Julia Hardy:
So good. I actually even, like, I bought the music after I'd played the game. That's how good.
Gabrielle Kent:
I did too. The soundtrack is gorgeous, isn't it? That cello. It's beautiful.
Julia Hardy:
Sometimes if I'm having a really, really stressful day with a lot of appointments, I listen to C418 who does the music for Minecraft as I go round London. It's quite calming, actually!
Gabrielle Kent:
I use that to get to sleep on a night actually.
Julia Hardy:
Do you?
Gabrielle Kent:
Yeah.
Julia Hardy:
See, this is really interesting. I mean, there's not really any kind of expansion on that. But I mean, in terms of like Ubisoft obviously that's a really big studio, you guys have got some money. How do you do it?
Sam Adamson:
Yeah, so we have a lot of internal teams as well. So it's all in-house, a lot of the good stuff, and it also means that the audio guys get to work with the developers at the same time, so you know, they're constantly evolving and changing the way that they're gonna approach the game. And it means that, you know, when it gets out there it's really highly polished and it all, you know, it completely fits the tone of the game as well.
Julia Hardy:
"What was your age when you starting gaming?" And that's from Ormiston primary school digital ninjas. So I think, I guess we've all started, we've all gamed. So Sam, how about you? When did you first start?
Sam Adamson:
Yes, sure. I would have started around probably the age of four or five. And it was actually like a [UNSURE OF WORD] system and then a mega drive and stuff like that. And then the early Nintendos and things like that. Because we used to play a lot of old platform games and side scrollers and everything like that, it was really good.
Julia Hardy:
Oh, yeah. Cool. How about you, Laura?
Laura Lowenthal:
Well, I'm not a gamer. But every child runs into games at some point in their life. For me it was when I was about eleven or twelve years old, and I had a small Atari console where I played my Tetris and frogger. That kind of thing.
Julia Hardy:
Frogger. The quest to get across the road.
Gabrielle Kent:
I'm really lucky, because I was born in the mid seventies, so I got to grow up with the games industry. So I think I started when I was about five and my dad bought me a [UNSURE OF WORD] so I was playing things like chucky egg and frogger, and then my best friend had an Atari so I used to go round her house to play Pacman, so I've just kind of grown up with the industry, which has been really exciting.
Julia Hardy:
I just remember growing up, because it was quite expensive, so not everyone had like all the different consoles. So you had like, one friend who had this one, and you'd go round and see her if you wanted to play a particular game. And then you'd go round to someone elses house, it was like everyone was like, the sort of community library of games that you would share together.
Gabrielle Kent:
You're either a SAGA or Nintendo person.
Julia Hardy:
We can't get into the whole SAGA, Nintendo debate because we haven't got enough time. We'll tell you about it another time. So anyway, that's it. Thanks very, very much to you guys for answering all of the questions, and we hope you've enjoyed the live lesson, and we will see you again very very soon. Bye!
Gabrielle Kent:
Bye!
Doctor Who and the micro:bit - Live Lesson - Your questions answered
Our expert guests from Google, Ubisoft and Teesside University answer your questions.
Watch the full Live Lesson
If you enjoyed these clips, why not catch up with this Live Lesson and learn more about computer science here

Secondary Live Lessons
Find out more about our Live Lessons designed for secondary school students

BBC Live Lessons homepage
Return to the BBC Live Lessons homepage for more curriculum-linked Live Lessons across primary and secondary
