Skip to content
Transcript

Today, you used an important computer science concept.

If statements.

This game and all other video games, could not be created without them.

But, did you know that you use if statements everyday?

Here are some examples.

If I'm thirsty, then I'll get a drink of water.

If it's raining, then I'll bring an umbrella.

If statements are just the type of logic that help people make decisions.

Computer scientists just like you, can use if statements to program a computer, or a robot to think and make decisions.

Today you programmed a sprite to follow a mouse pointer through a maze.

But, it's possible to use if statements to program sprites or even cars to go through a maze on their own.

Take a look at an example.

This robot has sensors that allow it to see walls.

If the robot sees a wall, then it turns.

The robot repeats this if statement until it reaches the end of the maze.

This basic idea of programming a robot using if statements, has some amazing real world applications.

Take a look at another example of how computer science can be used to help people and to save lives.

This video explains a self driving car.

For a vehicle to drive itself, it needs to know where it is in the world.

And it also needs to know what's around it.

Based on these factors, it needs to be able to make smart and safe driving decisions in the real world.

So think of the sensors as the cars eyes and ears.

But with eyes, it can see far off into the distance, and 360 degrees around the car.

And the great thing about having all of these sensors, is that they can talk to each other, and get cross checked information about the environment.

So why we've taken a ton of information using our sensors.

It's our software that really processes all of this and differentiates between objects.

All these objects are visible on the laptop that the safety drivers use while testing the vehicles.

Based on what the vehicle senses and processes, these objects will be represented by different color boxes.

Cyclists will be red, pedestrians yellow and the vehicles will appear as either green or pink.

These boxes demonstrate the processing that takes place within the software.

And think about the complexity here.

People look different, cars have different shapes and sizes.

Yet despite these nuances, the software needs to classify these objects appropriately based on factors like their shape, movement pattern, or location.

Car accidents are the number one cause of death for young people.

And accidents are mostly caused by human error.

Unlike humans, computers can see all around.

Never get distracted and react in an instant to hazards.

Driverless cars and computer scientists can save lives.

The self driving car is still many years away from being sold, because like you, the computer scientists creating it spend a lot of time testing their code, ensuring that the car drives in the way they intend.

And the next to Csfirst club, you will continue to use if statements while making a platform game.

Remember to look for ways to use coding in your daily life.

Talk to your teachers about building a scratch report on a topic for class.

Until then, have fun creating an coding.

See you next time.

Instructions

Write a G+ shout-out!
Attributions
  • "A Ride in the Google Self Driving Car" by Goog Self-Driving Car Project (https://www.youtube.com/watch?v=TsaES--OTzM) -- Licensed by Creative Commons Attribution 3.0 Unported (https://creativecommons.org/licenses/by/3.0/legalcode) -- Video trimmed to needed length
  • "Google's Lexus RX 450h Self-Driving Car" by Steve Jurvetson (https://commons.wikimedia.org/wiki/File:Google%27s_Lexus_RX_450h_Self-Driving_Car.jpg) -- Licensed by Creative Commons 2.0 Generic (https://creativecommons.org/licenses/by/2.0/) -- No modifications made
  • "mBot Solving a Maze" by Charles McKnight (https://www.youtube.com/watch?v=yx6JtQVpcUw) -- Licensed by Creative Commons Attribution 3.0 Unported (https://creativecommons.org/licenses/by/3.0/legalcode) -- Video trimmed to needed length | Blocks overlayed on top
  • "Nervous System Project (School)" by mewwkitty (https://scratch.mit.edu/projects/18652496/) -- Licensed under CC BY-SA 2.0 (https://creativecommons.org/licenses/by-sa/2.0/)
  • "Japanese car accident" by Shuets Udono (https://commons.wikimedia.org/wiki/File:Japanese_car_accident_blur.jpg) -- Licensed under CC BY-SA 2.0 (https://creativecommons.org/licenses/by-sa/2.0/) -- No modifications made