Cracking the Code

Download Subtitles

Transcript

0:00:09 > 0:00:12Being a racing driver is an exciting job

0:00:12 > 0:00:15that needs split-second reactions and nerves of steel.

0:00:15 > 0:00:18When driving round tracks at high speeds,

0:00:18 > 0:00:21it's important that drivers know exactly what they're doing.

0:00:21 > 0:00:24Nowadays, racing simulators are used by all the top racing teams

0:00:24 > 0:00:26to train their drivers.

0:00:26 > 0:00:29These simulators aim to recreate the racing experience

0:00:29 > 0:00:31as closely as possible.

0:00:31 > 0:00:35So, how do computers make the virtual world so realistic?

0:00:35 > 0:00:37I'm here at Silverstone racing track

0:00:37 > 0:00:40with my computer hackers to find out more.

0:00:40 > 0:00:41I'm Bradley.

0:00:41 > 0:00:43I'm Hannah.

0:00:43 > 0:00:45Hi, I'm Stuart, I'm going to be your driver.

0:00:50 > 0:00:53Before we can find out how realistic simulators are,

0:00:53 > 0:00:56we first need to know what it's like in a real car.

0:00:56 > 0:00:58So we're getting in the back

0:00:58 > 0:01:00as racing driver Stuart takes the wheel.

0:01:08 > 0:01:11Wow, that is so fast and really scary!

0:01:13 > 0:01:16Luckily, Stuart's a professional who knows what he's doing.

0:01:16 > 0:01:19To get that good, he's needed to do a lot of practice.

0:01:21 > 0:01:23OK, how was it?

0:01:23 > 0:01:25- Amazing.- It was really cool.

0:01:25 > 0:01:28How come you can go so fast on the track?

0:01:28 > 0:01:32It's fair to say I've probably done quite a few laps around Silverstone,

0:01:32 > 0:01:33I do know it very well.

0:01:33 > 0:01:35And also I know the car very well,

0:01:35 > 0:01:37so you put those two things together

0:01:37 > 0:01:39and obviously that makes it easy for me.

0:01:41 > 0:01:45But nowadays, drivers don't do all their practice on the real track.

0:01:46 > 0:01:50Our next stop is the University of Hertfordshire

0:01:50 > 0:01:52to see how their racing simulator helps drivers

0:01:52 > 0:01:54to get the perfect lap time.

0:01:54 > 0:01:57I'm here with Geoff, who runs the simulator,

0:01:57 > 0:02:00and Claire, whose company makes the simulators.

0:02:00 > 0:02:02So guys, what do you think?

0:02:02 > 0:02:03Awesome.

0:02:03 > 0:02:05Absolutely amazing.

0:02:06 > 0:02:08What's it made up from?

0:02:08 > 0:02:13The simulator is a complex mix of high-tech hardware and software.

0:02:13 > 0:02:16On the hardware side, we've got the motion base,

0:02:16 > 0:02:19we have the steering wheel, the pedals, the screens.

0:02:19 > 0:02:21And on the software side,

0:02:21 > 0:02:23we have lots of models working hard behind the scenes

0:02:23 > 0:02:25to make sure the driver sees the right thing

0:02:25 > 0:02:27and feels the right thing.

0:02:28 > 0:02:31And to make sure the driver does feel and see the right thing,

0:02:31 > 0:02:33programmers have to know about physics.

0:02:33 > 0:02:36They need to understand how cars behave in real life,

0:02:36 > 0:02:40so that they can programme the simulator to work in the same way.

0:02:42 > 0:02:44- So if you practise on one of these... - Yeah.

0:02:44 > 0:02:46..would you be able to drive a real car?

0:02:46 > 0:02:48You would, yeah.

0:02:48 > 0:02:50I mean, drivers come in here, professional drivers,

0:02:50 > 0:02:53they will drive the car, learn the circuit

0:02:53 > 0:02:57and we've had drivers win the race straight after this,

0:02:57 > 0:02:59they've never been to the circuit before.

0:02:59 > 0:03:00Can we have a go?

0:03:00 > 0:03:02Of course, let's go and do it.

0:03:17 > 0:03:21In order to make the simulator as realistic as possible,

0:03:21 > 0:03:25programmers have to make a very accurate virtual world

0:03:25 > 0:03:26inside the computer.

0:03:26 > 0:03:28We call this modelling.

0:03:31 > 0:03:34So the simulator code must use the laws of physics,

0:03:34 > 0:03:37it has to know how to work out the speed of the car

0:03:37 > 0:03:39or the forces that the driver feels.

0:03:41 > 0:03:46It also needs lots of information - lengths, heights, weights,

0:03:46 > 0:03:51numbers that describe the car, the track, the bumps, everything.

0:03:51 > 0:03:56So we create our model of the world using rules and information.

0:03:56 > 0:03:57This file describes the car,

0:03:57 > 0:03:59so if we have a look at it here,

0:03:59 > 0:04:01there's various numbers,

0:04:01 > 0:04:02you've got the mass of the car,

0:04:02 > 0:04:05so that tells you how much the car weighs in kilograms.

0:04:05 > 0:04:08We have power, we have braking,

0:04:08 > 0:04:10we have the torque of the engine,

0:04:10 > 0:04:14so how much power the engine's able to deliver to the track.

0:04:17 > 0:04:19What happens if you change the numbers?

0:04:19 > 0:04:21These numbers?

0:04:21 > 0:04:22Well, you could make a new car.

0:04:22 > 0:04:24If we took some of these numbers,

0:04:24 > 0:04:27maybe we changed 20 of the numbers,

0:04:27 > 0:04:31things like the engine performance, the engine speed,

0:04:31 > 0:04:32the weight of the car...

0:04:32 > 0:04:36we can make that Renault Megane drive like the F1 car

0:04:36 > 0:04:38and be as fast as the F1 car.

0:04:38 > 0:04:39That's pretty cool.

0:04:39 > 0:04:41So can we have a go with the Formula 1?

0:04:41 > 0:04:43We can, yeah, but that is tough,

0:04:43 > 0:04:46you've got to be good to drive the F1 car.

0:05:07 > 0:05:11So Hannah and Bradley had a few crashes in the Formula 1 car.

0:05:11 > 0:05:13Good job it's just a simulator.

0:05:13 > 0:05:17But now, it's time to find out how a professional does it.

0:05:22 > 0:05:25We've seen how we can represent different cars using information

0:05:25 > 0:05:28like the mass of the car or the power of the engine.

0:05:28 > 0:05:31But how does a simulator use that information

0:05:31 > 0:05:34to create a thrilling experience which responds to the driver?

0:05:34 > 0:05:38That's done by writing the computer program.

0:05:38 > 0:05:40How do you programme the simulator?

0:05:40 > 0:05:44What we can see here is the core computer code of the simulator,

0:05:44 > 0:05:48we can see it's a set of many, many commands -

0:05:48 > 0:05:51if you turn left, the simulator will move in such a way

0:05:51 > 0:05:54that you feel like you're really turning left.

0:05:54 > 0:05:57If you put your foot down on the accelerator,

0:05:57 > 0:05:59it's going to make you feel you're going really fast.

0:05:59 > 0:06:02That's all written in this code.

0:06:02 > 0:06:05On screen, we've got a load of words and symbols,

0:06:05 > 0:06:07but when we run this code,

0:06:07 > 0:06:09it creates the whole simulator experience

0:06:09 > 0:06:11and brings the virtual world to life.

0:06:11 > 0:06:14This code is where the programmers are applying the laws of physics.

0:06:14 > 0:06:17What else does the simulator have to do?

0:06:17 > 0:06:21The simulator is having to do so many different things at once.

0:06:21 > 0:06:24If you're the driver and you're hurtling towards a corner,

0:06:24 > 0:06:25the simulator needs to know -

0:06:25 > 0:06:28are you going to make the corner in time?

0:06:28 > 0:06:30If you don't, are you going to spin off and hit the wall?

0:06:30 > 0:06:32Is it raining? Are you going to slip?

0:06:32 > 0:06:35What noises does it need to make, what do the graphics need to show?

0:06:35 > 0:06:38Every single element of the simulator is talking to each other

0:06:38 > 0:06:40- about 1,000 times a second. - Wow!

0:06:40 > 0:06:42So, guys, what did you think of that?

0:06:42 > 0:06:45- Awesome.- Scary.

0:06:45 > 0:06:48So, how did the two of you think it compared to Silverstone?

0:06:48 > 0:06:51When you were racing round, it looked really real.

0:06:51 > 0:06:53It was fun,

0:06:53 > 0:06:57but it wasn't quite as real as being actually at Silverstone.

0:06:57 > 0:06:59The simulator isn't perfect,

0:06:59 > 0:07:02because there are limits to what computers can do.

0:07:02 > 0:07:04So how much information they can read,

0:07:04 > 0:07:06how fast they can work out calculations,

0:07:06 > 0:07:10or how much detail the graphics card can draw on the screen.

0:07:10 > 0:07:13So simulators may still have some way to go,

0:07:13 > 0:07:15but computer programmers are improving on their programs,

0:07:15 > 0:07:19and newer computers are making it easier and faster

0:07:19 > 0:07:21to work with more information,

0:07:21 > 0:07:23so simulators can become even more realistic,

0:07:23 > 0:07:27to the point where maybe it will be difficult to tell the difference

0:07:27 > 0:07:31between computer-generated environments and the real world.

0:07:42 > 0:07:45Video games are popular all over the world

0:07:45 > 0:07:48and I know I can be found playing on my games console for hours.

0:07:48 > 0:07:51But creating the game can be just as fun and challenging

0:07:51 > 0:07:52as playing the game itself.

0:07:52 > 0:07:55So I've come to St Saviour's Primary School, in London,

0:07:55 > 0:07:59to meet the year sixes who are using Scratch to create games.

0:07:59 > 0:08:01So do you all like playing video games?

0:08:01 > 0:08:03ALL: Yes.

0:08:03 > 0:08:04All of you, that's great.

0:08:04 > 0:08:06Well, today, you are going to get some cool stuff,

0:08:06 > 0:08:09you're going to create your own video game.

0:08:09 > 0:08:10It's a simple game of cat and mouse,

0:08:10 > 0:08:13and you're controlling the mouse with your mouse.

0:08:13 > 0:08:16'The children are using a free piece of coding software.

0:08:16 > 0:08:20'All the commands you need are laid out on the left hand side,

0:08:20 > 0:08:24'these are all the instructions which make up your code.

0:08:24 > 0:08:28'You then drag all the commands into the middle to write your program.

0:08:28 > 0:08:31'On the right, you have your characters, or sprites,

0:08:31 > 0:08:34'and above this, your stage, where you can view everything.'

0:08:34 > 0:08:38- The mouse is trying to run away from the cat.- Oh, wow.

0:08:38 > 0:08:40OK, so how are you doing that?

0:08:40 > 0:08:42- You have to give it a script.- OK.

0:08:42 > 0:08:47So for the mouse mine is "move 20 steps"

0:08:47 > 0:08:49and it would be quite boring

0:08:49 > 0:08:51if you had to press it and press it over again,

0:08:51 > 0:08:53so you would go to Control,

0:08:53 > 0:08:57then you would put "for ever",

0:08:57 > 0:09:00- or you can do "repeat", but I'm choosing "for ever".- OK.

0:09:00 > 0:09:03And so you could put sounds on it,

0:09:03 > 0:09:05just jam it in through here

0:09:05 > 0:09:10and it has to, you have to go to Controls again,

0:09:10 > 0:09:15and there's an option saying "when green flag clicked",

0:09:15 > 0:09:17so you put it at the very top.

0:09:17 > 0:09:19And let's test it out and...

0:09:19 > 0:09:21Oh yeah, that's cool.

0:09:21 > 0:09:23'Although the children are designing the same basic game,

0:09:23 > 0:09:27'the beauty of using coding software such as this

0:09:27 > 0:09:30'is that it gives the freedom to develop your own version

0:09:30 > 0:09:32'and be as creative as you like.'

0:09:32 > 0:09:37This mouse, Herbert, follows me around and the cat, Felix,

0:09:37 > 0:09:39follows Herbert around,

0:09:39 > 0:09:44but when Herbert gets caught by Felix, he turns into a ghost.

0:09:44 > 0:09:46Wow!

0:09:46 > 0:09:48'Like all good games, we need a scoring system.

0:09:48 > 0:09:52'A score is a variable, so you need to use the variable commands

0:09:52 > 0:09:54'in the top left of the screen.'

0:09:54 > 0:09:59Every time Herbert gets caught by Felix,

0:09:59 > 0:10:01the score goes minus 100,

0:10:01 > 0:10:03and it goes up every second

0:10:03 > 0:10:05when you keep him away from Felix.

0:10:05 > 0:10:09OK, so every time the mouse gets caught by Felix,

0:10:09 > 0:10:10- you lose 100 points.- Yeah.

0:10:10 > 0:10:13But, as long as you keep the mouse away from Felix,

0:10:13 > 0:10:15- you're gaining points all the time. - Yeah.

0:10:19 > 0:10:22- So you have four sprites in your game?- Yeah.

0:10:22 > 0:10:24That's a bit complicated.

0:10:24 > 0:10:27- Yeah, it's a harder game to play than the one on here.- Uh-huh.

0:10:27 > 0:10:31I still need to work a bit on the programming of the two new ones,

0:10:31 > 0:10:35cos it's not really working with the other two ones.

0:10:35 > 0:10:38Yeah, at the moment, it looks like Herbert and that fish,

0:10:38 > 0:10:41- one of your new sprites, is kind of glued together.- Yeah.

0:10:41 > 0:10:44All right, well, it seems awfully complicated,

0:10:44 > 0:10:45so I'll let you get on with that.

0:10:45 > 0:10:49'When you're programming, things often don't work out the first time,

0:10:49 > 0:10:52'so you have to really make sure you've understood the problem

0:10:52 > 0:10:56'and that you have all the right steps, and in the right order.

0:10:56 > 0:10:58'All this coding has got them thinking

0:10:58 > 0:11:00'about the kind of games they'd like to create,

0:11:00 > 0:11:04'the rules of the games, and how they'd fit together.'

0:11:04 > 0:11:06I would like to make a game based on pinball,

0:11:06 > 0:11:13and when the ball touches some holes, it gets points.

0:11:13 > 0:11:14I would like to make a maze

0:11:14 > 0:11:18and you have to... The character will follow you with your mouse

0:11:18 > 0:11:21and you have to collect like, food items along the way to power up.

0:11:21 > 0:11:24I would like to make my own car game.

0:11:24 > 0:11:26You have to avoid objects

0:11:26 > 0:11:29and if you hit an object, you lose points.

0:11:29 > 0:11:31Now you've heard their ideas,

0:11:31 > 0:11:33what sorts of game would you make?

0:11:45 > 0:11:46Where are we?

0:11:46 > 0:11:48The Parliament of the Daleks.

0:11:51 > 0:11:52I don't know about you,

0:11:52 > 0:11:54but I'm a massive Doctor Who fan.

0:11:54 > 0:11:56I grew up watching The Doctor,

0:11:56 > 0:11:59transfixed as he travelled around the universe

0:11:59 > 0:12:01escaping from all the weird and wonderful cultures.

0:12:03 > 0:12:04A lot's changed since then,

0:12:04 > 0:12:06different Doctors have come and gone,

0:12:06 > 0:12:09but I think it's fair to say that the show gets better and better

0:12:09 > 0:12:11and looks more and more stunning.

0:12:11 > 0:12:14And a lot of that is due to computer programming.

0:12:16 > 0:12:18Hi, I'm Joey.

0:12:18 > 0:12:19Hi, I'm Effie.

0:12:19 > 0:12:23So me and my two lucky hackers, Effie and Joey,

0:12:23 > 0:12:25who are both Doctor Who crazy,

0:12:25 > 0:12:27have both come to BBC Television Centre

0:12:27 > 0:12:29to find out where it all began.

0:12:35 > 0:12:38Back in the 1960s, when Doctor Who started,

0:12:38 > 0:12:40they used to make all these props by hand,

0:12:40 > 0:12:43I mean, they still make some of the props by hand now,

0:12:43 > 0:12:44but it's all a bit time-consuming,

0:12:44 > 0:12:47so how else do you think they make them?

0:12:47 > 0:12:49- Using computers... - Graphics and stuff.

0:12:49 > 0:12:50Shall we go and find out?

0:12:50 > 0:12:52- Yeah.- Come on, let's go, then.

0:12:56 > 0:12:58The next stop is the Visual Effects Studio.

0:12:58 > 0:13:01There are many elements that go into making Doctor Who

0:13:01 > 0:13:03such an amazing, magical show.

0:13:03 > 0:13:06But some of it isn't possible with just actors and props.

0:13:06 > 0:13:09So, guys, we're here with Cat and guess what?

0:13:09 > 0:13:11She works on Doctor Who!

0:13:11 > 0:13:12Really?

0:13:12 > 0:13:15Do you actually do the episodes and stuff and like that?

0:13:15 > 0:13:18Yeah, we work on a lot of the Doctor Who episodes.

0:13:18 > 0:13:20Cat shows the children

0:13:20 > 0:13:22how computers are used

0:13:22 > 0:13:25to produce really exciting visual effects for the series.

0:13:25 > 0:13:28So, let's have a look at this Dalek,

0:13:28 > 0:13:31this is one Dalek by itself, but...

0:13:31 > 0:13:34- Lonely.- Yeah, he looks lonely.

0:13:34 > 0:13:38So how do you think we could make a bunch more Daleks?

0:13:38 > 0:13:42BOTH: Um... Copy and paste?

0:13:42 > 0:13:43THEY CHUCKLE

0:13:43 > 0:13:46Well, we could do that, but it would take a really, really long time,

0:13:46 > 0:13:51so, instead, we're going to be lazy and use some programming.

0:13:51 > 0:13:54And I've got this little bit of script here

0:13:54 > 0:13:58and I can run that to make a set of Daleks,

0:13:58 > 0:14:02six rows with six in each row.

0:14:03 > 0:14:05'So with this piece of code,

0:14:05 > 0:14:10'we can create six rows of six Daleks from the one original Dalek.

0:14:10 > 0:14:12'The code tells us that for each row,

0:14:12 > 0:14:15'and for every position within the row, make one Dalek.

0:14:20 > 0:14:22'Then, move the Dalek into position.'

0:14:28 > 0:14:30So, if I just run that.

0:14:32 > 0:14:34Wow! That's a lot of Daleks.

0:14:34 > 0:14:37We have a little army of Daleks.

0:14:37 > 0:14:39When I watched Doctor Who as a kid,

0:14:39 > 0:14:41often from behind the sofa,

0:14:41 > 0:14:44you could only ever have a few Daleks on screen,

0:14:44 > 0:14:46because they were actual props,

0:14:46 > 0:14:49but here we're creating whole armies with a little computer code.

0:14:49 > 0:14:52'It's terrifying.'

0:14:52 > 0:14:54What's even more amazing

0:14:54 > 0:14:57is that every single Dalek in that army can behave independently.

0:14:57 > 0:15:01Using a piece of code, called the rand command,

0:15:01 > 0:15:04we can instruct each Dalek to move its eyestalk,

0:15:04 > 0:15:06head and body randomly.

0:15:07 > 0:15:09So can we all have a go at changing the code?

0:15:09 > 0:15:12Yeah, sure, we could make them look in the same direction,

0:15:12 > 0:15:14if you'd like.

0:15:14 > 0:15:15Yeah, that would look cool.

0:15:15 > 0:15:17So let's change the head rotate,

0:15:17 > 0:15:20cos that's which direction they're looking in,

0:15:20 > 0:15:24so, instead of this, which picks a random number,

0:15:24 > 0:15:29what we're going to do is we can put in just a number that you choose.

0:15:29 > 0:15:31So let's give them a number.

0:15:31 > 0:15:34Um... I don't know.

0:15:34 > 0:15:35Pick a number.

0:15:37 > 0:15:42By changing the code, we replace the rand command with a set number

0:15:42 > 0:15:46and hey presto, you have an army of Daleks staring in one direction.

0:15:46 > 0:15:48And they all look the same,

0:15:48 > 0:15:50exactly the same way.

0:15:50 > 0:15:53So you wouldn't want to be facing them.

0:15:56 > 0:15:59'But that's exactly what we're going to do

0:15:59 > 0:16:00'as visual effects artist, Rose,

0:16:00 > 0:16:02'puts our acting skills to the test.

0:16:02 > 0:16:05'Right, Rose, what's our motivation?'

0:16:05 > 0:16:07In this scene, it's the Dalek Parliament,

0:16:07 > 0:16:10so you're all surrounded by Daleks,

0:16:10 > 0:16:12and I want you to look like, kind of scared.

0:16:12 > 0:16:15Brilliant. Yeah, that works, like that.

0:16:15 > 0:16:17Brilliant. And action.

0:16:24 > 0:16:27When we want to mix actors with computer-generated effects,

0:16:27 > 0:16:29you need to film them against a green screen,

0:16:29 > 0:16:31so you can replace the background

0:16:31 > 0:16:33with something you've designed yourself.

0:16:33 > 0:16:36They're everywhere, what are you going to do?

0:16:36 > 0:16:38Right, now, stand up, stand up.

0:16:38 > 0:16:42Cool, now, look really brave.

0:16:42 > 0:16:44Now, you're not going to be scared of these guys,

0:16:44 > 0:16:47the Doctor's going to come along and save you in a bit.

0:16:47 > 0:16:49'OK, that's a wrap.

0:16:49 > 0:16:52'Now, it's back to the edit to upload and review the footage.'

0:16:52 > 0:16:54You look great, don't you?

0:16:55 > 0:16:57Your face is all covered up.

0:16:59 > 0:17:00Wow, look at you, guys.

0:17:00 > 0:17:02Oh, it's hilarious!

0:17:02 > 0:17:06So shall we put you guys in this?

0:17:06 > 0:17:08All right, so...

0:17:09 > 0:17:11I'm going to use the computer here

0:17:11 > 0:17:13to select all of the green and get rid of it.

0:17:13 > 0:17:14- Are you ready?- Yeah.

0:17:14 > 0:17:17It's going to look really cool.

0:17:17 > 0:17:18There it goes, see?

0:17:18 > 0:17:21Is this how they film Doctor Who, then?

0:17:21 > 0:17:24Yeah, this is how all of the green screen shots are done on Doctor Who,

0:17:24 > 0:17:27using this kind of method.

0:17:27 > 0:17:28That's so cool!

0:17:28 > 0:17:30How long does it take to film an episode?

0:17:30 > 0:17:32It depends on the episode,

0:17:32 > 0:17:35it can be anywhere between a few weeks

0:17:35 > 0:17:38or a couple of months, it depends on how many creatures are in it.

0:17:38 > 0:17:42Now, I can put you on top of the footage I have here,

0:17:42 > 0:17:45so that you'll be sitting in the Dalek Parliament.

0:17:45 > 0:17:48So here we go.

0:17:48 > 0:17:50That's you guys there.

0:17:50 > 0:17:51Wow. That's so cool.

0:17:51 > 0:17:55'Rose has used a graphics package to superimpose us into the shot.

0:17:55 > 0:17:56'The computer runs a program

0:17:56 > 0:17:59'which has removed all the green pixels from the footage

0:17:59 > 0:18:03'and then merged the video with the computer-generated images.

0:18:03 > 0:18:05'Hollywood, eat your heart out.

0:18:05 > 0:18:07'Here comes the finished shot,

0:18:07 > 0:18:10'the three of us transported into the Dalek Parliament.'

0:18:13 > 0:18:14Here I am!

0:18:15 > 0:18:18'And here's the Doctor on the same set.'

0:18:18 > 0:18:21Remember, next time, when you watch all the monsters on Doctor Who,

0:18:21 > 0:18:24that lots of them were generated by computers

0:18:24 > 0:18:27and computer code was used to make them move around and look scary.

0:18:27 > 0:18:30And it's all done by artists and coders

0:18:30 > 0:18:32sitting around computers like these.

0:18:47 > 0:18:49When writing your own computer program,

0:18:49 > 0:18:53you'll sometimes want to include graphics.

0:18:53 > 0:18:55I'm here with the pupils from the Ilsleys Primary School

0:18:55 > 0:18:58so we can create our own computer graphics.

0:18:58 > 0:19:00You can create something known as a bitmap

0:19:00 > 0:19:03and that's when you break the picture down into a grid

0:19:03 > 0:19:04of different coloured squares.

0:19:06 > 0:19:08Hi, guys!

0:19:08 > 0:19:12So we've given you a stack of cards and also a grid, known as a bitmap,

0:19:12 > 0:19:15and that has a series of zeros and ones.

0:19:15 > 0:19:17Every time you see a zero, that represents white.

0:19:17 > 0:19:20When you see a one, that represents a black.

0:19:20 > 0:19:22So just turn over the cards when you see a one

0:19:22 > 0:19:24and see what picture you get.

0:19:27 > 0:19:29'We've got two different teams,

0:19:29 > 0:19:32'and each team is working through a different bitmap grid.'

0:19:32 > 0:19:35Zero up there, white up there.

0:19:35 > 0:19:38'When there's a zero in the grid, they place the card white face up,

0:19:38 > 0:19:43'when there's a one, they place it black face up.

0:19:43 > 0:19:46'We're using only zeros and ones to represent the information

0:19:46 > 0:19:48'and we call this binary.

0:19:50 > 0:19:52'So a computer can represent graphics and pictures

0:19:52 > 0:19:54'as a grid of numbers.

0:19:55 > 0:19:59'Each number tells us the colour of one small square called a pixel,

0:19:59 > 0:20:03'and we build up the whole picture using a load of these pixels.'

0:20:03 > 0:20:05All right, so, guys, how are you approaching this,

0:20:05 > 0:20:06how are you working as a team?

0:20:06 > 0:20:09We're doing the corners first and then seeing where they're going.

0:20:09 > 0:20:12- So you're the director, telling everyone what to do.- Yeah.

0:20:12 > 0:20:14And they place them. Oh, that's cool.

0:20:16 > 0:20:19Guys, wow, you seem to be doing really well. What's your strategy?

0:20:19 > 0:20:21- Going row, row, row.- Row, row, row.

0:20:21 > 0:20:23Cool, so what do you think it could be?

0:20:23 > 0:20:27I have no idea, it looks like antennae.

0:20:32 > 0:20:34- We don't know... - You've lost where you're at.

0:20:34 > 0:20:37One, two, three, four, five, you're on the sixth level up.

0:20:41 > 0:20:45Wow, you guys were super quick, that was awesome.

0:20:45 > 0:20:47So what do you think it could be?

0:20:47 > 0:20:50- Alien.- An alien? Do you all think that?

0:20:50 > 0:20:52- Like a robot.- A robot?

0:20:52 > 0:20:54What about computers?

0:20:54 > 0:20:55Think about games.

0:20:55 > 0:20:58- Space Invaders!- Space Invaders, I think that's right.

0:21:00 > 0:21:02Wow, you guys have done it as well.

0:21:02 > 0:21:04So what do you reckon this is?

0:21:04 > 0:21:06- A dog.- A dog? What makes you say that?

0:21:06 > 0:21:08Because it's got the legs and it's got the ears,

0:21:08 > 0:21:10and it's kind of got the body shape.

0:21:10 > 0:21:13- OK, oh, yeah, and that over there's a tail, I suppose.- Yeah.

0:21:13 > 0:21:15OK, no eyes, though.

0:21:15 > 0:21:19But I've got to ask you, how come that leg down there,

0:21:19 > 0:21:21it seems by itself?

0:21:21 > 0:21:22Is there a black missing?

0:21:22 > 0:21:25So I reckon this one actually should be a black,

0:21:25 > 0:21:27I think it was a number one.

0:21:27 > 0:21:29Yeah...

0:21:29 > 0:21:32- Now, that looks a bit better, doesn't it?- Yeah.

0:21:32 > 0:21:34So, guys, these look totally awesome.

0:21:34 > 0:21:36However, they do look rather blocky

0:21:36 > 0:21:38and that's because the squares we're using are rather big.

0:21:38 > 0:21:42So I have some smaller squares, which are a quarter of the size -

0:21:42 > 0:21:43you can fit four of these

0:21:43 > 0:21:45into one of the squares you've got at the moment

0:21:45 > 0:21:49making it a bit smoother, and that's something we call higher resolution.

0:21:55 > 0:21:58'A higher resolution picture contains more pixels,

0:21:58 > 0:22:02'so there's more information and we can have more detail.

0:22:02 > 0:22:05'And there are other ways to improve the picture too.

0:22:05 > 0:22:09'Today, we're only using zero and one for white and black,

0:22:09 > 0:22:13'but if we used more numbers, we could have different colours.

0:22:13 > 0:22:15'When your computer stores a photo,

0:22:15 > 0:22:20'each pixel could be any one of over 16,000,000 colours.'

0:22:20 > 0:22:24That's better already, can you see? It's actually less harsh,

0:22:24 > 0:22:29it curves a bit more, these edges are a lot smoother.

0:22:29 > 0:22:31Yeah, that's working really well, cool.

0:22:31 > 0:22:33This is pretty impressive.

0:22:33 > 0:22:35Oh, you've even put the white bits in the ears.

0:22:35 > 0:22:39Yeah, I thought if we could have even smaller squares,

0:22:39 > 0:22:42coloured maybe pink inside,

0:22:42 > 0:22:45it would look even more effective.

0:22:45 > 0:22:48Yeah, you could have the pink inside the ears, that would be great.

0:22:48 > 0:22:51So what do you think, do you like it, do you think it looks better?

0:22:51 > 0:22:52A bit smoother?

0:22:52 > 0:22:54It has a higher resolution.

0:22:56 > 0:22:58So, guys, these look great.

0:22:58 > 0:23:00The smaller squares have improved it already,

0:23:00 > 0:23:03and if we were to go even smaller with the squares,

0:23:03 > 0:23:06we could make it much better, and if we were to add more numbers,

0:23:06 > 0:23:10not just the zeros and ones, we could actually add some colour too.

0:23:24 > 0:23:27Nowadays, miniature computers are everywhere,

0:23:27 > 0:23:29inside our tablets and mobile phones.

0:23:29 > 0:23:31This is a new generation computer,

0:23:31 > 0:23:34the size of a credit card.

0:23:34 > 0:23:37These tiny computers are what my hackers and I

0:23:37 > 0:23:38have come to see today.

0:23:38 > 0:23:39I'm Lottie.

0:23:41 > 0:23:43I'm Harry.

0:23:45 > 0:23:46And this is Dave.

0:23:46 > 0:23:49Today, he's showing us the exciting things

0:23:49 > 0:23:52we can do with a tiny computer and a bit of programming.

0:23:52 > 0:23:53What is a Raspberry Pi?

0:23:53 > 0:23:57It's a small computer, it's very cheap and it's very lightweight.

0:23:57 > 0:24:02I thought it would be about that big,

0:24:02 > 0:24:06but it's a lot smaller and it can still fit everything you need.

0:24:06 > 0:24:09Some things you recognise off a normal computer,

0:24:09 > 0:24:11and there's other things you've never seen before

0:24:11 > 0:24:14because it's like on the inside, it's inside a computer.

0:24:17 > 0:24:19Because it's a fully functional computer,

0:24:19 > 0:24:22you can programme it to do all sorts of amazing things,

0:24:22 > 0:24:25like building your own electronics projects.

0:24:25 > 0:24:27And because it's small,

0:24:27 > 0:24:30Dave and his friends have done something really cool.

0:24:32 > 0:24:35You might think these photos were taken by satellite,

0:24:35 > 0:24:39but, actually, they were taken from this balloon.

0:24:39 > 0:24:43Hanging from the balloon is a box which contains an ordinary webcam,

0:24:43 > 0:24:46a sat nav tracker, a radio transmitter

0:24:46 > 0:24:49and, of course, the miniature computer,

0:24:49 > 0:24:51which Dave has programmed to snap the photos

0:24:51 > 0:24:54and then beam them back down to Earth.

0:24:54 > 0:24:58So this is what we have in the payload, as it's called,

0:24:58 > 0:25:01there's the webcam that it takes photos with,

0:25:01 > 0:25:05and that's the aerial, so that dangles out the bottom

0:25:05 > 0:25:11of the box and that transmits signals maybe 300, 500 miles away.

0:25:11 > 0:25:12And how do you get the signals?

0:25:12 > 0:25:16I've got a ten-metre pole in the garden there

0:25:16 > 0:25:18- with an aerial up the top.- Oh, wow!

0:25:18 > 0:25:22'So Dave's connected the webcam and sat nav tracker as inputs

0:25:22 > 0:25:25'and the radio transmitter is the output.

0:25:25 > 0:25:27'Now we know how it all works,

0:25:27 > 0:25:29'let's get the kit ready for launch.'

0:25:31 > 0:25:33Perfect, and then just slide in.

0:25:35 > 0:25:39'The computer and webcam go into the protective box,

0:25:39 > 0:25:42'and this will be hung underneath the balloon.'

0:25:42 > 0:25:44That's probably the biggest balloon you've ever seen.

0:25:44 > 0:25:48'Dave fills the balloon with helium, just like a massive party balloon.'

0:25:52 > 0:25:53It's attacking me.

0:25:53 > 0:25:55SHE LAUGHS

0:26:04 > 0:26:07'With Dave and his friends, we ease it up into the sky.

0:26:07 > 0:26:09'There's a balloon, a parachute,

0:26:09 > 0:26:13'our computer and a backup transmitter

0:26:13 > 0:26:16'so we can find it even if the computer goes wrong.'

0:26:16 > 0:26:18Three, two, one!

0:26:18 > 0:26:21THEY LAUGH

0:26:26 > 0:26:30Bye-bye, balloon, see you later.

0:26:31 > 0:26:33With the balloon launched,

0:26:33 > 0:26:35the webcam is already taking pictures.

0:26:35 > 0:26:38Each picture is split up into sections

0:26:38 > 0:26:40which are transmitted piece by piece

0:26:40 > 0:26:43over the radio transmitter back to Earth.

0:26:43 > 0:26:45The photos look stunning,

0:26:45 > 0:26:47but the quality of the image isn't very high.

0:26:47 > 0:26:51The radio transmitter can send us the photos from a long way away,

0:26:51 > 0:26:56but it's quite slow, so we can only send low-resolution pictures.

0:26:56 > 0:27:01So, when I programme this, I have to choose what size image to take

0:27:01 > 0:27:03and how much to compress it down to a file

0:27:03 > 0:27:06that takes not too long to send.

0:27:06 > 0:27:09So there's a compromise between a nice big image

0:27:09 > 0:27:12that's got lots of detail but takes for ever to send

0:27:12 > 0:27:15and then, a nice small image that we can send lots of.

0:27:15 > 0:27:17All of this only works

0:27:17 > 0:27:19because Dave's written some programs for the tiny computer

0:27:19 > 0:27:22which make everything work together.

0:27:22 > 0:27:24So what does the code look like?

0:27:24 > 0:27:27It just looks like somebody's randomly done that.

0:27:27 > 0:27:29Oh, yeah, that's how I build my programs.

0:27:29 > 0:27:31It's not too bad actually.

0:27:31 > 0:27:34One program tells the webcam to take the pictures

0:27:34 > 0:27:36and what resolution to take them at.

0:27:36 > 0:27:38This is written as a loop

0:27:38 > 0:27:43so the webcam keeps taking pictures one after another, every 30 seconds.

0:27:43 > 0:27:47Another program sends output to the radio transmitter,

0:27:47 > 0:27:50transmitting the pictures to Earth.

0:27:50 > 0:27:53It also sends the position from the sat nav tracker,

0:27:53 > 0:27:56so that Dave and his friends can track the balloon.

0:28:03 > 0:28:06With the balloon floating up above Earth,

0:28:06 > 0:28:08Dave and his wife Julie set off to chase it.

0:28:08 > 0:28:11The program on the minicomputer is constantly transmitting

0:28:11 > 0:28:13its height and location,

0:28:13 > 0:28:15so we know exactly where it is.

0:28:15 > 0:28:18The balloon could land hundreds of kilometres away -

0:28:18 > 0:28:20it's even landed in the sea before.

0:28:20 > 0:28:22Let's hope that doesn't happen today.

0:28:30 > 0:28:33Meanwhile, back at Mission Control,

0:28:33 > 0:28:34with Dave's friend Anthony,

0:28:34 > 0:28:37we view the pictures as well as tracking the balloon

0:28:37 > 0:28:39and following Dave's progress.

0:28:40 > 0:28:43OK, so those are just coming in now,

0:28:43 > 0:28:46those are slightly higher than you would go in a plane.

0:28:46 > 0:28:48If you just go up a little bit,

0:28:48 > 0:28:52- you see the sky's beginning to get dark.- Yeah.- Yeah.

0:28:52 > 0:28:54And you're getting more and more of the curvature of the Earth.

0:28:54 > 0:28:57It's incredible, it's amazing.

0:28:57 > 0:28:59I like that one because there's the sun,

0:28:59 > 0:29:01the Earth and the black of space.

0:29:01 > 0:29:03Yeah, it's beautiful, it's gorgeous.

0:29:03 > 0:29:06That's one of my favourites because it's really bright.

0:29:06 > 0:29:08Yeah. That's incredible.

0:29:11 > 0:29:13It's amazing to think these photos were taken

0:29:13 > 0:29:15by a computer the size of a credit card

0:29:15 > 0:29:19floating above the clouds in a homemade box.

0:29:19 > 0:29:21Dave even holds the record

0:29:21 > 0:29:24for the highest photograph taken by amateur equipment,

0:29:24 > 0:29:27nearly 40 kilometres above the Earth.

0:29:27 > 0:29:30But today, our balloon is only travelling

0:29:30 > 0:29:32up to about 30 kilometres.

0:29:32 > 0:29:36That's still three times as high as a passenger plane flies.

0:29:36 > 0:29:41Then, it bursts and starts its descent back to Earth by parachute.

0:29:41 > 0:29:44- OK, there it goes, it's just burst. - Oh, wow!

0:29:44 > 0:29:45Looks like it's burst.

0:29:45 > 0:29:48Oh, good, what altitude did it burst at?

0:29:48 > 0:29:4930, 431.

0:29:49 > 0:29:5130, 431. OK, that's good.

0:29:51 > 0:29:54So Dave now knows, so he will go and track it down.

0:29:54 > 0:29:57Yeah, he will have picked up in the car that it's burst

0:29:57 > 0:29:58and he will now be going.

0:29:58 > 0:30:02'After about 30 minutes, the balloon lands back on Earth.'

0:30:02 > 0:30:04So that's the field it's landed in.

0:30:04 > 0:30:07'Once the height we're receiving stops going down,

0:30:07 > 0:30:09'we know the balloon's landed

0:30:09 > 0:30:13'and, of course, we also get a picture of the ground.'

0:30:13 > 0:30:15Can we talk to Dave?

0:30:15 > 0:30:17Yeah, absolutely, yeah, if you type in that box there,

0:30:17 > 0:30:19type in, "Dave, head up the M11."

0:30:22 > 0:30:26We're heading left on the M11 in a few miles. Excellent!

0:30:37 > 0:30:39There's a road on the left there,

0:30:39 > 0:30:41so that's probably where we want Dave to get to.

0:30:47 > 0:30:50As night falls, Dave pulls up in the field,

0:30:50 > 0:30:53but will he be able to find the box in the dark?

0:30:55 > 0:30:59There you go, so, how has it survived?

0:30:59 > 0:31:03That looks pretty good, so almost completely intact,

0:31:03 > 0:31:05and that's what's left of the balloon.

0:31:05 > 0:31:07TELEPHONE RINGS

0:31:07 > 0:31:10- Oh, there you go. Well, let's see where they're at.- It's just moved.

0:31:10 > 0:31:12Hiya, Dave.

0:31:12 > 0:31:13Hey, Anthony, how are you doing?

0:31:13 > 0:31:15- Hey, excellent.- 'I have some good news for you.'

0:31:15 > 0:31:17I am holding in my hand

0:31:17 > 0:31:19a parachute, the full piece of latex

0:31:19 > 0:31:22and the Pi payload and buzz as well.

0:31:22 > 0:31:23ALL: Yeah!

0:31:23 > 0:31:24Superb!

0:31:24 > 0:31:26'That's cool.'

0:31:26 > 0:31:28They're quite pleased.

0:31:28 > 0:31:30- Very pleased, yeah. - Speak to you soon.

0:31:30 > 0:31:32- 'Thank you, bye-bye.' - Bye, cheers, bye.

0:31:34 > 0:31:37This has been a record-breaking piece of programming,

0:31:37 > 0:31:40and we've been able to take some amazing pictures.

0:31:40 > 0:31:41'By learning to program,

0:31:41 > 0:31:43'there's all sorts of things we can make possible,

0:31:43 > 0:31:46'whether it's creating a game for our mobile phone

0:31:46 > 0:31:50'or doing something really cool with a tiny computer.'

0:31:50 > 0:31:51The sky's the limit.

0:32:02 > 0:32:05Today's computers are getting smaller and cheaper,

0:32:05 > 0:32:07and this little thing is a Raspberry Pi.

0:32:07 > 0:32:09It's a credit card-sized computer

0:32:09 > 0:32:14and you can plug in your keyboard, mouse and monitor.

0:32:14 > 0:32:17These have been designed to explore computer programming,

0:32:17 > 0:32:19so I've come to St Saviour's Primary

0:32:19 > 0:32:20to see how they're using their Pi

0:32:20 > 0:32:23to generate code that has some real bite.

0:32:24 > 0:32:26'Getting started is really straightforward.

0:32:26 > 0:32:31'Just like any computer, plug in your inputs, such as your keyboard,

0:32:31 > 0:32:35'and your outputs, in this case, your monitor.

0:32:35 > 0:32:36'With the computers connected up,

0:32:36 > 0:32:40'we're using open source coding software

0:32:40 > 0:32:42'to programme a motion-sensing crocodile,

0:32:42 > 0:32:44'so that when you place your finger in the croc's mouth,

0:32:44 > 0:32:46'it'll bite you.'

0:32:48 > 0:32:50It's now croc time, so you should see a box of Lego

0:32:50 > 0:32:52along with some instructions - get going!

0:33:01 > 0:33:03'So first off, following the instruction sheet,

0:33:03 > 0:33:06'the group need to build their crocodile.'

0:33:06 > 0:33:09Donna, where does this one go?

0:33:09 > 0:33:12'The crocodile will then be brought to life by connecting it up

0:33:12 > 0:33:16'to the miniature computer before we start the coding.'

0:33:16 > 0:33:17- Is it those?- Yeah!

0:33:17 > 0:33:19OK, so what are all these bits?

0:33:19 > 0:33:23So, this is the motor and this is the sensor,

0:33:23 > 0:33:26so when the finger comes along,

0:33:26 > 0:33:31- there will be a thing here and it will...- Trap your finger.

0:33:31 > 0:33:32Yeah, trap your finger.

0:33:32 > 0:33:34So it will be the roof of the mouth.

0:33:34 > 0:33:37And then, what does the motor do?

0:33:37 > 0:33:39So the motor powers it to go up and down.

0:33:39 > 0:33:41Up and down, oh, cool.

0:33:41 > 0:33:47'So, in this system, the sensor is the input and the motor the output.'

0:33:47 > 0:33:50So if you put your finger here, it will bite you?

0:33:50 > 0:33:51Yeah.

0:34:00 > 0:34:02So has everyone finished building their crocodiles?

0:34:02 > 0:34:03ALL: Yes.

0:34:03 > 0:34:05Awesome, now we're getting to the dangerous bit.

0:34:05 > 0:34:08We want you to write a program, using Scratch,

0:34:08 > 0:34:10so that when you put your finger in the crocodile's mouth,

0:34:10 > 0:34:12it will bite you.

0:34:12 > 0:34:15In the same way that the crocodile fits together piece by piece,

0:34:15 > 0:34:19this computer code fits together like building blocks.

0:34:19 > 0:34:22All the commands you need are on the left hand side of the screen,

0:34:22 > 0:34:25which you drag into the middle to write your program.

0:34:25 > 0:34:29For this program, we're going to need to use the sensing commands,

0:34:29 > 0:34:32which tell the crocodile when to shut its mouth.

0:34:32 > 0:34:36The sensor value tells you how far you are from the crocodile's mouth.

0:34:36 > 0:34:40As your hand gets closer to the sensor, the number decreases,

0:34:40 > 0:34:43so you need to check what number it goes down to

0:34:43 > 0:34:45when your finger is in its mouth.

0:34:46 > 0:34:49Now that the croc is programmed to know when to bite,

0:34:49 > 0:34:52we need to programme it so it knows how to bite,

0:34:52 > 0:34:55so we need to write some code for the croc's motor

0:34:55 > 0:34:57so its mouth will open and shut.

0:34:57 > 0:35:01Great, so you've programmed yours to start biting your finger, right?

0:35:01 > 0:35:03- Yeah.- OK, do you want to show me what you did?

0:35:03 > 0:35:07So, as you can see, it's less than 20,

0:35:07 > 0:35:11it won't bite unless it's under 20.

0:35:11 > 0:35:15- So 20, that's the distance your finger is from the sensor.- Yeah.

0:35:15 > 0:35:20So when it closes, it stays on for one second,

0:35:20 > 0:35:24and then, this way means it goes open,

0:35:24 > 0:35:27so it goes that way for one second and then this way.

0:35:27 > 0:35:31- So it bites your finger for one second and then lets go?- Yeah.- OK.

0:35:31 > 0:35:33- And that's all down to your programming?- Yeah.

0:35:33 > 0:35:35Oh, that's so cool.

0:35:35 > 0:35:37'And it really is that straightforward

0:35:37 > 0:35:39'to write a simple computer program.'

0:35:39 > 0:35:44Congratulations, you all built and coded a finger-biting crocodile.

0:35:44 > 0:35:46Did anyone lose any fingers though?

0:35:46 > 0:35:47ALL: No.

0:35:47 > 0:35:49Good stuff.

0:35:49 > 0:35:52'It's incredible to think you can do all this

0:35:52 > 0:35:54'with such a tiny little computer.

0:35:54 > 0:35:56'I wonder what else you can do with it?'

0:36:09 > 0:36:12Robots aren't just in science-fiction stories,

0:36:12 > 0:36:15they're already playing a role in our lives,

0:36:15 > 0:36:17from making cars, toys and electronic gadgets -

0:36:17 > 0:36:20we've even got them playing their own sport now.

0:36:20 > 0:36:22WHISTLE

0:36:22 > 0:36:24All robots are controlled by a computer,

0:36:24 > 0:36:28but the question is, how does the computer tell them what to do?

0:36:28 > 0:36:30My hackers and I are going to find out.

0:36:30 > 0:36:32Hi, I'm Sam.

0:36:32 > 0:36:34Hi, I'm Saffia.

0:36:34 > 0:36:37We've come to Plymouth University to meet their robot football team.

0:36:37 > 0:36:38Come on, guys!

0:36:41 > 0:36:43One, two, three, go!

0:36:49 > 0:36:52Today, it's people versus machines.

0:36:52 > 0:36:54Sam and Saffia are using game controllers

0:36:54 > 0:36:56to control these white robots,

0:36:56 > 0:36:59but they're up against Plymouth's Black Ninja robots,

0:36:59 > 0:37:03who play football in the International Robot World Cup.

0:37:03 > 0:37:05The black robots have been programmed

0:37:05 > 0:37:07so they can play by themselves,

0:37:07 > 0:37:09they don't need anyone controlling them with joy pads.

0:37:09 > 0:37:11It's pretty clever stuff.

0:37:12 > 0:37:14These are our football robots.

0:37:14 > 0:37:16The rules state, in the competition,

0:37:16 > 0:37:19that all the robots have to be what's known as autonomous,

0:37:19 > 0:37:21that means automatic.

0:37:21 > 0:37:24So they have to do everything by themselves,

0:37:24 > 0:37:26without humans controlling.

0:37:26 > 0:37:30The main thing about these robots is that they use shapes

0:37:30 > 0:37:32and colours to define things,

0:37:32 > 0:37:35but they have to have little tricks,

0:37:35 > 0:37:39like an orange thing on a green background.

0:37:39 > 0:37:40If you took that orange ball

0:37:40 > 0:37:43and you put it over in a different coloured background,

0:37:43 > 0:37:44it won't think that's the ball.

0:37:44 > 0:37:49You have to make very simple rules to make it understand what to do.

0:37:49 > 0:37:54THEY CHEER

0:37:55 > 0:37:58'To make robots play for themselves,

0:37:58 > 0:38:00'we have to write computer code -

0:38:00 > 0:38:02'it's this code that makes the robot do things,

0:38:02 > 0:38:04'like walk or kick the ball.

0:38:04 > 0:38:06'Programmers need to think hard

0:38:06 > 0:38:09'about exactly what actions the robot needs to perform,

0:38:09 > 0:38:11'what things does the program need to know

0:38:11 > 0:38:14'and what things doesn't it need to worry about.

0:38:14 > 0:38:18'For example, if we want to programme a robot goalkeeper

0:38:18 > 0:38:21'we need to know where the ball is and when it's heading for the goal,

0:38:21 > 0:38:24'so the position is the most important thing.

0:38:24 > 0:38:28'We can think of a number line for our position,

0:38:28 > 0:38:31'with zero in the middle where our goalkeeper starts.

0:38:31 > 0:38:34'If the ball is heading for the negative numbers,

0:38:34 > 0:38:36'then the goalkeeper dives to the right.

0:38:36 > 0:38:37'If it's positive,

0:38:37 > 0:38:40'then the goalkeeper dives to the left,

0:38:40 > 0:38:43'and if it's near the middle, then he stays in the middle.

0:38:43 > 0:38:47'But what does the code to control the goalkeeper actually look like?'

0:38:47 > 0:38:52If the ball is between this far away and over to the left,

0:38:52 > 0:38:54then we want you to dive left.

0:38:54 > 0:38:57'If the position along the goal line

0:38:57 > 0:39:00'is bigger than 100 but less than 2,000,

0:39:00 > 0:39:03'then the code makes the goalkeeper dive to the left.

0:39:06 > 0:39:11'But if the position is between minus 100 and minus 2,000,

0:39:11 > 0:39:13'the goalkeeper dives right.'

0:39:13 > 0:39:17And also, we have to have a robot that just stands in the middle,

0:39:17 > 0:39:19because, otherwise, if he dived left

0:39:19 > 0:39:21and the ball was going straight at us, it would be a goal.

0:39:21 > 0:39:24'If the position is close to zero,

0:39:24 > 0:39:26'in between minus 100 and positive 100,

0:39:26 > 0:39:30'then the goalkeeper stays in the middle.

0:39:30 > 0:39:33'So the goalkeeper decides what he's going to do

0:39:33 > 0:39:35'using these "if" conditions.'

0:39:41 > 0:39:43How do you write such a long and complicated code?

0:39:43 > 0:39:49A long piece of code is made up of small functions,

0:39:49 > 0:39:53and the functions do various little things that we want.

0:39:53 > 0:39:55So "looking for ball" would be a function.

0:40:00 > 0:40:03Then "walk to ball" would be another function.

0:40:08 > 0:40:10So that makes it much more manageable.

0:40:10 > 0:40:13So robots break down playing football

0:40:13 > 0:40:16into a series of different functions, simple tasks.

0:40:16 > 0:40:19I wonder how different that is from what Sam and Saffia are doing

0:40:19 > 0:40:22when they're controlling their robots.

0:40:22 > 0:40:23Oh, come on!

0:40:23 > 0:40:25BOTH: Yeah!

0:40:25 > 0:40:27Once a program has been written,

0:40:27 > 0:40:30the code gets downloaded onto the robot.

0:40:30 > 0:40:33Each robot has its own processor board,

0:40:33 > 0:40:34a tiny computer that runs the code

0:40:34 > 0:40:37so it can decide what the robot should do.

0:40:41 > 0:40:44All right, guys, that's it, OK.

0:40:44 > 0:40:46The scores are 2-0 to the white team.

0:40:46 > 0:40:48THEY CHEER

0:40:48 > 0:40:49'With so many things to do,

0:40:49 > 0:40:51'playing football's actually a very complicated game

0:40:51 > 0:40:53'for a robot to play.

0:40:53 > 0:40:55'Even with all the long code,

0:40:55 > 0:40:58'the autonomous robots couldn't always find the ball

0:40:58 > 0:40:59'or kick it in the right direction,

0:40:59 > 0:41:03'so they just couldn't win against Saffia and Sam.'

0:41:03 > 0:41:07Press that button there and he'll do an impression of Usain Bolt.

0:41:07 > 0:41:08HE CHUCKLES

0:41:08 > 0:41:10It's a pretty good look, right?

0:41:14 > 0:41:17So robots can be programmed to play football and other games

0:41:17 > 0:41:21by breaking the tasks down into a series of simple instructions.

0:41:21 > 0:41:24But this robot is called iCub,

0:41:24 > 0:41:26and he doesn't need step by step instructions,

0:41:26 > 0:41:28he can learn what to do for himself.

0:41:28 > 0:41:31We looked at how children learn

0:41:31 > 0:41:35and we tried to model that process

0:41:35 > 0:41:38so that our robot is able to learn

0:41:38 > 0:41:40in the same way that you or I can.

0:41:42 > 0:41:43This is a box.

0:41:45 > 0:41:46iCub: Box.

0:41:46 > 0:41:47- Cool.- What is this?

0:41:49 > 0:41:50iCub: Box.

0:41:53 > 0:41:55This is a stapler, what is this?

0:41:56 > 0:41:57iCub: Stapler.

0:41:59 > 0:42:01Where is the box?

0:42:07 > 0:42:10'So iCub has been programmed in a different way.

0:42:10 > 0:42:12'His computer program can learn new things,

0:42:12 > 0:42:16'and that's a very complicated program to write.'

0:42:16 > 0:42:18Does it only recognise one voice

0:42:18 > 0:42:20or does it recognise other people's voices?

0:42:20 > 0:42:24We use a commercial software for speech recognition,

0:42:24 > 0:42:26and that's been trained on my voice.

0:42:26 > 0:42:29Does it understand Northern, my accent?

0:42:29 > 0:42:31- It would if we trained it on your voice, yes.- OK.

0:42:31 > 0:42:34Getting speech recognition to work with children is difficult

0:42:34 > 0:42:36because the pitch is much higher.

0:42:37 > 0:42:40'So the robot really only understands Tony's voice,

0:42:40 > 0:42:43'but we're going to give it a go anyway.'

0:42:43 > 0:42:45This is a box.

0:42:45 > 0:42:47What is this?

0:42:48 > 0:42:51'Try speaking deeper, try to sound more like Tony.'

0:42:51 > 0:42:53This is a box.

0:42:54 > 0:42:56What is this?

0:43:00 > 0:43:02iCub: Box.

0:43:02 > 0:43:05Yeah, that's cool!

0:43:09 > 0:43:12This is a stapler, what is this?

0:43:15 > 0:43:17iCub: Box.

0:43:20 > 0:43:21Where is the box?

0:43:25 > 0:43:28THEY CHEER

0:43:28 > 0:43:31'Tony says that iCub's learning things like children do.

0:43:31 > 0:43:33'I wonder how similar it is

0:43:33 > 0:43:36'to the way people actually do learn things.'

0:43:36 > 0:43:39Why did it get some things wrong?

0:43:39 > 0:43:44If we'd written our program as a series of steps to execute,

0:43:44 > 0:43:46then it would have gone through those steps

0:43:46 > 0:43:48and it would have performed perfectly.

0:43:48 > 0:43:50What's going on here with iCub,

0:43:50 > 0:43:55because it's learning things in much the same way that children do,

0:43:55 > 0:43:56it does make mistakes,

0:43:56 > 0:43:58it makes quite a lot of mistakes

0:43:58 > 0:44:01and that doesn't always make for the best demo.

0:44:01 > 0:44:05What iCub's doing that's different is...

0:44:05 > 0:44:09it's working in situations that the designer can't foresee -

0:44:09 > 0:44:12you can't lay down a set of rules saying, you know,

0:44:12 > 0:44:15"This is what a stapler is going to look like." All right?

0:44:15 > 0:44:18Because then somebody will bring in some new stapler

0:44:18 > 0:44:21that looks a bit different and iCub's lost.

0:44:21 > 0:44:24'Learning a few objects might not seem like much,

0:44:24 > 0:44:25'but this is early days.

0:44:25 > 0:44:29'Programmers like Tony are constantly developing their programs

0:44:29 > 0:44:32'and improving them so that one day in the future,

0:44:32 > 0:44:36'robots will be able to learn to do all sorts of things.'

0:44:36 > 0:44:40So there's still some way to go, but, like all technologies,

0:44:40 > 0:44:42it only takes a matter of time.

0:44:42 > 0:44:45Maybe in the future, you'll be working on the next generation

0:44:45 > 0:44:47of robot football players.

0:44:59 > 0:45:01Have you ever wanted to own your own robot?

0:45:01 > 0:45:03Robots are really cool, but they're useless

0:45:03 > 0:45:06if you can't tell them what you want them to do

0:45:06 > 0:45:07in a way that they'll understand.

0:45:07 > 0:45:10So I'm here at The Digital School House

0:45:10 > 0:45:12with some pupils from Marish Primary School

0:45:12 > 0:45:15and they're going to show me how they program their own robots.

0:45:16 > 0:45:18We've got a map of a town,

0:45:18 > 0:45:22full of buildings like hairdressers, florists and a gym.

0:45:22 > 0:45:25Our car is going to start next to the sports shop at A

0:45:25 > 0:45:28and then drive through the town to the baker's at B.

0:45:32 > 0:45:34FD,

0:45:34 > 0:45:37RT90,

0:45:37 > 0:45:39FD.

0:45:39 > 0:45:41First of all, we've got to plan our route,

0:45:41 > 0:45:45breaking it down into a sequence of step-by-step instructions.

0:45:45 > 0:45:48We can get around the whole town with just three instructions -

0:45:48 > 0:45:53move forward, turn left 90 degrees and turn right 90 degrees, so that

0:45:53 > 0:45:57our car follows the road through the town avoiding all buildings.

0:45:58 > 0:46:02FD, FD, done.

0:46:03 > 0:46:06Now, we're recreating the town on our computer,

0:46:06 > 0:46:10using different pictures to represent the shops and buildings.

0:46:10 > 0:46:14We're making this like a town so the car can move around.

0:46:14 > 0:46:19We're trying to match these pictures with those pictures over there.

0:46:19 > 0:46:23OK, so all these objects represent shops in the town, is that it?

0:46:23 > 0:46:25Yeah.

0:46:25 > 0:46:28So we go to gym, we press gym.

0:46:28 > 0:46:30So you've just added gym to the objects of things

0:46:30 > 0:46:32that now are on your map.

0:46:32 > 0:46:34Yeah, so it will make it more interesting, cos then

0:46:34 > 0:46:40the robotic car can go to lots of different places, like everyday life.

0:46:40 > 0:46:42Oh, cool.

0:46:42 > 0:46:45Now we create a procedure called "Drive".

0:46:45 > 0:46:47A procedure is the list of instructions

0:46:47 > 0:46:52that our car is going to follow. It will only do exactly what we tell it

0:46:52 > 0:46:55so we've got to make sure we've got all the instructions right

0:46:55 > 0:46:58otherwise the car will go the wrong way.

0:46:58 > 0:47:00So can you tell me about the commands?

0:47:00 > 0:47:06Well, I'm telling it to do forward, forward, right turn 90 degrees.

0:47:06 > 0:47:12So the FD means forward and then the RT90 means right turn 90,

0:47:12 > 0:47:15so that 90 is the degrees you want your car to turn.

0:47:15 > 0:47:19These simple instructions are the building blocks of our code,

0:47:19 > 0:47:21and with the right sequence of instructions

0:47:21 > 0:47:24we can make the robot travel any route we like.

0:47:25 > 0:47:27So, where will your car end up, then?

0:47:27 > 0:47:29Next to the bakery.

0:47:29 > 0:47:32- OK, fingers crossed, that's if everything works out.- Yeah.

0:47:32 > 0:47:34An important part of programming

0:47:34 > 0:47:37is to test the code that we've written.

0:47:37 > 0:47:39Some of the groups have decided to test their procedures

0:47:39 > 0:47:44on the computer before they try it out with their actual robot.

0:47:44 > 0:47:46That's a good idea, because it's going to be much quicker

0:47:46 > 0:47:49to change it now rather than later.

0:47:49 > 0:47:51Looks like the car's crashing into the gym.

0:47:51 > 0:47:53You might need to check the code, guys!

0:47:55 > 0:47:58Once we've tested it, we need to connect up our car

0:47:58 > 0:48:02and download the procedure, so our code can tell the robot what to do.

0:48:03 > 0:48:07And now, the moment of truth. Have we got it right?

0:48:11 > 0:48:13We've made it past the first bend.

0:48:15 > 0:48:16Hang on!

0:48:16 > 0:48:18It's all gone wrong on this corner.

0:48:18 > 0:48:20We should have turned right 90 degrees,

0:48:20 > 0:48:24but we're going back the way we came. How did that happen?!

0:48:24 > 0:48:26And now we've crashed into the cake shop.

0:48:26 > 0:48:29That's what happens when you don't test your code properly!

0:48:39 > 0:48:40Looking good so far.

0:48:43 > 0:48:45So close!

0:48:45 > 0:48:47But they've gone forward again.

0:48:47 > 0:48:51They've missed the turn. Now they're not even on the map!

0:48:51 > 0:48:52And, into the crash barrier.

0:48:52 > 0:48:55When I was there, I was meant to do a RT90

0:48:55 > 0:48:58then move forward twice and then do an LE90.

0:48:58 > 0:49:01OK, so it was the right and left you got wrong, basically.

0:49:01 > 0:49:03Oh, that's such a shame, guys!

0:49:03 > 0:49:05- Do you think it's going to work? - Yeah!

0:49:05 > 0:49:08- Do you guys think it's going to work?- Yes.

0:49:08 > 0:49:11OK, let's go. Fingers crossed.

0:49:23 > 0:49:25Tension's mounting!

0:49:33 > 0:49:35Brilliant! We've made it!

0:49:35 > 0:49:39That's great, guys! Next to the baker, just how we wanted to be.

0:49:39 > 0:49:41Cool! It looks like it's going to be easy

0:49:41 > 0:49:44just to write a set of instructions, doesn't it?

0:49:44 > 0:49:45But actually, it's quite hard.

0:49:45 > 0:49:48But you need those instructions to be precise, so that your robot

0:49:48 > 0:49:52knows exactly where to go, that step-by-step process.

0:49:52 > 0:49:56When you're programming, you often have to find and fix mistakes

0:49:56 > 0:49:59until your code does exactly what you want.

0:49:59 > 0:50:00We call mistakes "bugs",

0:50:00 > 0:50:04and getting rid of the bugs is all part of the fun.

0:50:15 > 0:50:17Everybody loves playing with toys,

0:50:17 > 0:50:19whether it's train sets,

0:50:19 > 0:50:22action figures or board games.

0:50:23 > 0:50:27Many of today's toys already have computers in,

0:50:27 > 0:50:28but there's a new generation of toys

0:50:28 > 0:50:30which are way more sophisticated

0:50:30 > 0:50:33making their way into toy stores near you.

0:50:33 > 0:50:35To find out more about this,

0:50:35 > 0:50:39my two intrepid hackers, Edward and Hannah, have come with me

0:50:39 > 0:50:43to meet two guys who've created something quite extraordinary.

0:50:43 > 0:50:44Hi, I'm Edward.

0:50:46 > 0:50:48Hi, I'm Hannah.

0:50:48 > 0:50:50They've produced something they call AppToys,

0:50:50 > 0:50:52which use the newest technologies

0:50:52 > 0:50:55and the most inventive computer programming.

0:50:55 > 0:50:57So, guys, do you know what AppToys are?

0:50:57 > 0:50:59- Well, I know what apps are. - I know what toys are.

0:50:59 > 0:51:01But we're not really sure what AppToys are.

0:51:01 > 0:51:03OK, I think we're just about to find out.

0:51:06 > 0:51:07Hi, guys. Come on down.

0:51:11 > 0:51:15Thanks for coming. My name's Elliot, this is Martin.

0:51:15 > 0:51:17Together, we're toy developers

0:51:17 > 0:51:20and we'd like to show you our range of products.

0:51:20 > 0:51:25AppToys use smart devices, such as phones or tablets, to control them.

0:51:25 > 0:51:28First off, you download an app to your smart device,

0:51:28 > 0:51:30which is then placed inside the toy,

0:51:30 > 0:51:34such as a dog kennel or police car, which you buy from a toy shop.

0:51:34 > 0:51:38When you put the phone inside the kennel

0:51:38 > 0:51:42the phone recognises that it's inside the kennel.

0:51:42 > 0:51:45Then it divides the screen up accordingly

0:51:45 > 0:51:49so that it aligns with our mirrors, which gives it the 3D effect.

0:51:49 > 0:51:53So, we have the phone that has the app we downloaded,

0:51:53 > 0:51:56and then we've put it into this hardware, where there's mirrors,

0:51:56 > 0:51:58but how does it all come together?

0:51:58 > 0:52:04Are there sensors in the hardware, so the phone recognises it's there?

0:52:04 > 0:52:07Yeah, there's accelerometers and the accelerometer recognises

0:52:07 > 0:52:10what angle it's at, so if it's upside down,

0:52:10 > 0:52:13which is what is required for the kennel, we can recognise that.

0:52:13 > 0:52:15Smartphones are mini-computers

0:52:15 > 0:52:21and have a number of different inputs, processors and outputs.

0:52:21 > 0:52:24The accelerometer is one of these inputs

0:52:24 > 0:52:26and tells the phone which way up it is.

0:52:26 > 0:52:30The AppToy also uses the phone's other inputs, such as

0:52:30 > 0:52:34the microphone, and processing software like speech recognition.

0:52:34 > 0:52:38So, in this case, you give your virtual pets different commands.

0:52:38 > 0:52:40Chase tail.

0:52:40 > 0:52:41Wow!

0:52:41 > 0:52:44- So it's using voice activation. - That's good.

0:52:44 > 0:52:48- Can it roll over? - It can roll over. Roll over!

0:52:48 > 0:52:49THEY LAUGH

0:52:49 > 0:52:51- So how do you feed it? - You say, "Feed",

0:52:51 > 0:52:53then you put your finger through the front

0:52:53 > 0:52:55and the camera is looking for your finger

0:52:55 > 0:52:57so it knows that you've fed it.

0:52:57 > 0:53:00Some of the toys make use of the smartphones' ability

0:53:00 > 0:53:04to transfer information between them using Bluetooth technology.

0:53:04 > 0:53:06This one's a bit scarier than a dog.

0:53:06 > 0:53:09CREATURE ROARS

0:53:09 > 0:53:10That's called Battle-Dino

0:53:10 > 0:53:13because you train it to become a real fighting machine

0:53:13 > 0:53:16and then you send it to your friend's crate

0:53:16 > 0:53:19and they battle it out together, so the strongest dinosaur wins.

0:53:19 > 0:53:22- Wow!- That's really, really good.

0:53:22 > 0:53:23That's cool?

0:53:23 > 0:53:26- Good, we spent a long time working on it! - HE LAUGHS

0:53:27 > 0:53:31AppToys use the existing technologies of smartphones,

0:53:31 > 0:53:33but they still need to program all this technology

0:53:33 > 0:53:37to get it to do all the cool things they want it to.

0:53:37 > 0:53:41Programming whizz Martin shows us how he used computer coding

0:53:41 > 0:53:42to design the T-Rex game.

0:53:42 > 0:53:44HIGH-PITCHED ROAR

0:53:44 > 0:53:48In the game, the T-Rex will grow from a baby to an adult

0:53:48 > 0:53:51and as he gets bigger, his roar will have to change.

0:53:51 > 0:53:55Now, the really cool thing about coding and sound is that you can

0:53:55 > 0:53:59use the code to change the sound, so you don't need to have lots of

0:53:59 > 0:54:03different recordings of him roaring, you can just change it in code.

0:54:03 > 0:54:07And what we did, if we go back and look at the T-Rex code, you can

0:54:07 > 0:54:13see, when we go down here, we have this command, "audio.pitch", OK?

0:54:13 > 0:54:16The pitch of the sound is the quality that makes it

0:54:16 > 0:54:19either high or low, and what we're going to do is,

0:54:19 > 0:54:24we just make that pitch equal to the speed that he's animating at.

0:54:24 > 0:54:28The computer uses this number, the audio.pitch value,

0:54:28 > 0:54:31to determine how long to play the sound for.

0:54:31 > 0:54:33- So, can we have a go at that? - Yeah, sure.

0:54:33 > 0:54:38OK, so, instead of using the speed to do the pitch,

0:54:38 > 0:54:46it could be anything, really, from 0 to 5, 6 or like 2.5, 3.5.

0:54:46 > 0:54:48Shall we try 3.5?

0:54:48 > 0:54:51- Yeah, go on.- You type it.

0:54:51 > 0:54:543.5.

0:54:54 > 0:54:58And then we put that to finish the line, then we'll save it.

0:54:58 > 0:55:02So he's going to roar at 3.5 now.

0:55:02 > 0:55:04SQUEAKY ROAR

0:55:04 > 0:55:07THEY LAUGH

0:55:07 > 0:55:10That, it wasn't scary, it sounded like he was in pain!

0:55:10 > 0:55:12Like someone had stood on him!

0:55:12 > 0:55:14SQUEAKY ROAR

0:55:14 > 0:55:15Shall we make it a bit deeper?

0:55:15 > 0:55:18Do you want to choose a number that will make it a bit deeper?

0:55:18 > 0:55:230.25.

0:55:26 > 0:55:28Let's see what that sounds like.

0:55:29 > 0:55:33BOOMING, ECHOING ROAR

0:55:33 > 0:55:38If it gets too low, you won't even hear it, you'll just feel rumbling.

0:55:38 > 0:55:41That was like a train going through a tunnel or something, wasn't it?

0:55:41 > 0:55:43It was very deep.

0:55:44 > 0:55:45BOOMING ROAR

0:55:45 > 0:55:49And it's not just the pitch you need to code for.

0:55:49 > 0:55:52The T-Rex needs a really precise set of instructions.

0:55:52 > 0:55:56Commands to tell it when to grow, roar or when to walk.

0:55:58 > 0:56:00And it's the same for all the games.

0:56:00 > 0:56:02Computer code is written to control everything,

0:56:02 > 0:56:06from the speed of the police car, to the bark of the dog.

0:56:06 > 0:56:07DOG BARKS

0:56:07 > 0:56:10It's been great to get a behind the scenes look at all these AppToys

0:56:10 > 0:56:13and unlock some of the secrets of the coding.

0:56:13 > 0:56:18But Elliot has got one last thing to show us - their amazing aquarium.

0:56:18 > 0:56:22Oh, that's so cool, that looks so realistic!

0:56:22 > 0:56:25- Can we go?- Yeah.- Oh, wow!

0:56:25 > 0:56:28- It's epic.- Wow.- Looks 3D, right?

0:56:28 > 0:56:31Yeah! It's looks like you've got real fish there.

0:56:33 > 0:56:37So these things are actually there, and the rest is projected onto this?

0:56:37 > 0:56:40- You've got it absolutely right. - How does that work?

0:56:40 > 0:56:45Well, we're reflecting the image from the tablet

0:56:45 > 0:56:47onto some physical background that,

0:56:47 > 0:56:50some of it you can see and some of it you can't see.

0:56:50 > 0:56:53- So, can you see the doll on the right-hand side?- Yeah.

0:56:53 > 0:56:57So we've pre-programmed in that the fish know where that doll is,

0:56:57 > 0:56:59so when they swim behind it we make them disappear,

0:56:59 > 0:57:02so it gives the illusion the fish are actually there,

0:57:02 > 0:57:04so that's why the whole thing looks so realistic.

0:57:04 > 0:57:09It's also interactive, so I can fish in the fish tank.

0:57:09 > 0:57:12- Whoa!- Wow!- That is so cool!

0:57:12 > 0:57:16Wow, that's amazing! You can go fishing! Fishing in your home.

0:57:17 > 0:57:20In this setup, the information is being transferred

0:57:20 > 0:57:22between two devices.

0:57:22 > 0:57:24The phone's accelerometer is the input

0:57:24 > 0:57:27and the display from the tablet, the output.

0:57:27 > 0:57:30I'm just trying to figure out how it's all working!

0:57:30 > 0:57:33Well, it's using Bluetooth to connect between the two,

0:57:33 > 0:57:35and I'm using the accelerometers in here

0:57:35 > 0:57:38- to determine what I'm doing with it, so it knows whether I'm... - FISHING REEL WHIRRS

0:57:38 > 0:57:40Lifting it up or not.

0:57:40 > 0:57:41- Go on, have a go.- You go first.

0:57:41 > 0:57:43FISHING REEL WHIRRS

0:57:43 > 0:57:46- That's it.- You have to wait for a fish to come to you.

0:57:46 > 0:57:48Go on, pull up. Yes!

0:57:48 > 0:57:49That was a big one, as well!

0:57:49 > 0:57:52I think we'll give you the option to put it back in,

0:57:52 > 0:57:53so that people don't get upset.

0:57:53 > 0:57:55But this is only a prototype.

0:57:55 > 0:57:58Yeah, well, what we're going to do is, when we launch these,

0:57:58 > 0:57:59we're going to keep adding the features,

0:57:59 > 0:58:02so it's never going to end, we're always going to put stuff in.

0:58:02 > 0:58:05So if people come up with some good ideas, we can add it to it.

0:58:05 > 0:58:07So, once we want to add a new feature

0:58:07 > 0:58:10you just go back to the program, you write some new coding

0:58:10 > 0:58:13- and then someone can download that app.- Exactly.

0:58:13 > 0:58:16I bet the makers of this smartphone never imagined

0:58:16 > 0:58:19that it could be used to control a toy like this,

0:58:19 > 0:58:22where a little bit of programming has allowed the creators

0:58:22 > 0:58:25of these toys to use Bluetooth and speech recognition software

0:58:25 > 0:58:27in such a creative way.

0:58:27 > 0:58:28HIGH-PITCHED ROAR

0:58:28 > 0:58:32So maybe in the future, teddy bears and dinosaurs will just appear

0:58:32 > 0:58:36in your room, in 3D, when you open an app on your phone.

0:59:01 > 0:59:03Subtitles by Red Bee Media Ltd