Lesson 5: Chasing the speeding car around the town

  1. Understand loops: Grasp the concept of loops as a way to repeat instructions until a specific condition is met.
  2. Use repeat loops: Learn to create and utilize repeat loops in “unplug” programming to automate repetitive tasks.
  3. Apply loops to control car movements: Practice using loops with arrow instructions to control a car’s path around the street and ensure it returns to the starting point.

Introduction:

In computer programming, loops are like a set of instructions that allow the computer to repeat a certain action or a series of actions multiple times. It’s like telling the computer, “Hey, keep doing this until a specific condition is met.”

a robot in our “unplug” programming environment, and we want to control it to run around the street and come back to the starting point. We can create a sequence of arrows that represents the car moving forward, turning right at intersections, and following the street path. Then, we can use a repeat loop to ensure that the car continues following this sequence until it reaches the starting point again. By using this loop, we  need to manually repeat the same set of arrow instructions multiple times.

Activity:

Dialogue:

Dispatcher: 911, what’s your emergency?
Boy: (concerned) Hello, I need help! There’s a super-speedy driver zooming way too fast all around town!
Dispatcher: Don’t worry, I’ve got you covered! I’ll send a police officer to patrol the area. Can you give me the starting location and the ending location?
Boy: The speedy driver starts at the shop on 1 Main Street and ends at the fire station on 8 Main Street.
Dispatcher: Alrighty then! I’ll let the police officer know to first drive around once to find that speedy driver and then go for two more rounds to make sure nobody else is running too fast. It’s like a race against the speed demons!
Boy: (excited) That’s awesome! It’s like the police are on a mission to catch all the speedsters in town!
Dispatcher: Absolutely! Our police officers are like the superheroes of the road, keeping everyone safe. They’ll use their expert driving skills to track down the speedy driver and make sure no one else is breaking the speed limits.
Boy: Thank you so much for your help!
Dispatcher: You’re welcome! Stay on the line until the police officer arrives, and remember, even computer programming can play a role in keeping our streets secure. Goodbye for now!
Boy: Goodbye.

Answer keys:

 

Answer4 by wacheerapan kaewprapan