Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

7. Wrap-up: Maze Game


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 bring an 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” 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. In this video Sebastian Thrun explains the self-driving car.

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 and ensuring that the car drives the way they intend. In the next CS First 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 next time-- have fun creating and coding. See ya next time!

arrow_backward Back
Next arrow_forward
Write a G+ shout-out!