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 a task!
Part 1: Write a paper program. (10 minutes)
First, choose a task you want a robot to help with. For example:
Then, write down the list of steps to complete the task. This is your paper program!
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.
Want more challenge? Try this!
As you design the program for your robot, answer these questions:
Part 2: Create a flowchart. (20 minutes)
A flowchart is a diagram that represents an algorithm in the form of a map. Each step on a flowchart is represented by a different shaped box, connected by arrows.
For the next part of the activity, write your paper program from part 1 in the form of a flowchart. Use the symbols and instructions on the Create an Algorithm Flowchart handout to structure your flowchart.
If you need help, check out the Sample Algorithm Flowcharts to see how a flowchart works and get ideas to create your own.
When you finish your flowchart, act out the steps to see if the program works. If there’s a "bug" in the program, try to fix it!
Part 3: Write a program for a robot. (30 minutes)
When programming with a computer language, it’s important to get the syntax exactly right. Syntax is the set of rules used by a language. It includes spelling, spacing, symbols, and punctuation.
To plan out a program without worrying about syntax, programmers sometime use pseudocode. ("Pseudo" means fake.) Pseudocode uses commands in regular human language. It can then be translated into any kind of computer language. The only rule for pseudocode is that it should be easy to understand.
For the next part of the activity, use your flowchart from part 2 to write your program in lines of pseudocode.
Read through the information and examples on the Writing Pseudocode handout. Next, write a line of code using pseudocode for each step in your flowchart.
Then, test your program to see if it works. Just like before, pretend to be the robot. Follow the commands in your program, line by line, and act out what you read. As you test your program, take notes about any problems you find so you can go back and fix them.
How did it go?
Want more challenge? Try this!
And that’s it! You’ve now completed two steps of the Senior 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.