Today, you used a very 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 bringan umbrella. If I have a question in CS First, then I’ll put up my sticky note.
If statements are just a type logic that help people make decisions. Computer scientists,just like you, can use If statements to program a computer, or a robot, to “think” andmake decisions. Today, you programmed a sprite to follow amouse pointer through a maze. But, it’s possible to use if statements to program spritesor 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-worldapplications. Take a look at another example of how computerscience can be used to help people and to save lives. In this video Sebastian Thrunexplains the self-driving car.
Car accidents are the number one cause of death for young people, and accidents aremostly 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 computerscientists creating it spend a lot of time testing their code and ensuring that the cardrives the way they intend. In the next CS First club, you will continueto use if statements while making a platform game.
Remember to look for ways to use coding in your daily life. Talk to your teachers aboutbuilding a Scratch report on a topic for class.
Until next time-- have fun creating and coding. See ya next time!