Lesson 7: Someone is blocking the roads!!!

  1. Understand conditions: Grasp the concept of using conditions in computer programming to make decisions based on specific situations or criteria.
  2. Apply conditions in “unplug” programming: Utilize conditions with arrow instructions to control the robot car’s movements based on specific circumstances.
  3. Develop problem-solving and logical thinking skills: Engage in activities that involve using conditions to solve problems and make decisions in “unplug” programming.
  4. Create interactive programs: Design programs for the robot car that respond to different conditions, such as turning at intersections or avoiding obstacles.
  5. Test and debug programs with conditions: Learn to evaluate and troubleshoot programs that incorporate conditions to ensure the robot car behaves correctly.

Introduction:

Conditions in computer programming allow us to make decisions and control the behavior of programs based on certain situations or criteria. Just like in real life, we often make decisions based on conditions. For example, if it’s raining outside, we might take an umbrella; if it’s sunny, we might wear sunscreen. Similarly, conditions in computer programming help us create programs that can adapt and respond to different situations.

Conditions are important because they make our programs dynamic and flexible. They allow us to handle different scenarios and make choices based on specific conditions being met or not met. For example, we might want the robot car to move forward if it detects an obstacle in front, but turn right if there is no obstacle.

In “unplug” programming, we can use arrows to represent instructions for the robot car. By incorporating conditions, we can control the robot car’s movements based on specific circumstances. For instance, we can create a sequence of arrow instructions that tells the robot car to move forward if a certain condition is true, but turn left if the condition is false.

Activity:

Dialogue:

Boy: (excited and concerned) Hello, there’s an emergency! Me and my dad were driving around the city for fun, but we found out that a bad guy has set up barrels to block the road all over the place! We need help!
Dispatcher: Don’t worry, we’ll get you out of this situation! I’ll send a construction vehicle to remove the barrels and clear the roads for you. Can you give me your current location?
Boy: Thank you so much! We are currently at the intersection of Main Street and Park Avenue.
Dispatcher: Got it! I’ll inform the construction vehicle about the situation. They will use special programming skills, like “if” conditions, to select the best path that they can find barrels.
Boy: That sounds amazing!
Dispatcher: Our construction vehicle experts are up for the challenge! They’ll analyze the city map, just like solving a complex maze, to find blocked roads.
Boy: I can’t wait to see the construction vehicle in action! it’s like a clever puzzle solver on wheels!
Dispatcher: Absolutely! The construction vehicle will use its advanced navigation systems and clever programming tricks to identify  the routes. They’ll ensure you and your dad can continue your fun drive without any obstacles.
Boy: Thank you so much for your help! This construction rescue mission is going to be exciting!
Dispatcher: You’re welcome! Stay on the line until the construction vehicle arrives, and remember, computer programming can help us overcome unexpected challenges. Goodbye for now!
Boy: Goodbye, and thank you again! I’ll be eagerly waiting for the construction vehicle to clear the way for us!

Answer keys:

Answer6 by wacheerapan kaewprapan