Time needed: 60 minutes
A computer program is a type of algorithm—a set of step-by-step instructions. The list of steps for telling the robot how to complete a task is an algorithm. Recipes and driving directions are algorithms, too!
Computer programs are written in code, a language that can be understood by machines. Programs use commands to tell the machine what to do. A command is one step in a program.
You’ve been challenged to write a program a robot can follow to perform two different tasks. First, you’ll write a program for a task of your choice. Then, you’ll code a program a robot can follow to navigate and vacuum a room!
Part 1: Write a paper program. (15 minutes)
A computer program is a type of algorithm—a set of step-by-step instructions. Do you think you can write an algorithm to tell someone how to complete a familiar task?
Pick a simple physical task to turn into an algorithm. Use regular language—you don't need to write commands in computer code yet.
For example, here’s an algorithm you could use to plant a vegetable garden:
Other ideas for tasks include mowing the lawn, vacuuming a room, sorting objects into different bins by size or color, setting up a campsite, painting a room, grooming or feeding a pet, or packing up a fragile gift item to send across the country.
Test your program by following the commands in your program, line by line, and acting out what you read. As you test your program, take notes about any problems you find so you can go back and fix them.
Part 2: Write a program for a robot. (45 minutes)
Engineers design complicated machines for big factories, but they also use their skills to create products for the home. For example, Helen Greiner, one of the founders of the company iRobot, was working on an industrial-sized robotic vacuum, but it was so large and heavy that it could damage furniture or hurt people if anything went wrong. So, the iRobot team decided to work out any problems by making a smaller prototype. The smaller model was so handy that the company began producing it as the Roomba robotic vacuum, which is now used in homes around the country.
For the next part of the activity, you’re going to write simulated computer code that tells a robovac how to vacuum a room and return to its charging station. To help, you’ll use a checkerboard as a map of the room to be vacuumed, red checkers as obstacles, and a black checker as the robovac to be moved around the room. Your goal is to write a program that will move the red checker around every square that is not covered by a black checker.
When you’re writing a computer program, spelling and punctuation must be perfect. Otherwise, the computer won't understand what you’re trying to say. However, when you’re just trying to figure out the steps in your program and what order they should go in, it's OK to make up your own pseudocode. That means writing out the commands using real words to make it easier to understand.
Some examples of pseudocode that tell a robovac how to move around include:
FORWARD 3 = move ahead three squares
RIGHT = turn and face right
So, follow the challenge instructions found below and on the Programming Challenge handout to write pseudocode for a robovac.
Want more challenge? Try this!
Add sensors in your program! A robot is a machine that can sense, think, and act. That means you can tell the robot to gather information about its environment using its sensors, decide whether the information meets certain conditions by using its brain, and take different actions depending on what it finds. To add challenge to the activity, add instructions for sensors to your program.
For ideas on sensors and conditions to add to your robovac’s program and tips for programming a robot with sensors, check out the “Want more challenge?” section of the Programming Challenge handout.
And that’s it! You’ve now completed two steps of the Cadette Programming Robots badge! If you had fun doing this, you might want to learn more about robots and design your own with the rest of the Senior Robotics badges.
Troop Leaders: The instructions for all badge steps are available free of charge in your Girl Scout Volunteer Toolkit.
Girl Scout Activity Zone activities have been adapted from existing Girl Scout programming.