Summary

Introduction
Have you ever wanted a robot assistant that could do all your household chores? Science fiction has been showing us such robots for decades, but they're still not available! What's taking so long? In this project you will investigate some of the challenges in programming a "robot" to do a simple household task, such as making a sandwich.
Materials
- Bread
- Peanut butter
- Jelly
- Knife
- Plate
- Paper towels
- Volunteer
- Pencil and paper
- Surface that can tolerate a little bit of mess
Prep Work
- Think about the procedure you follow to make a peanut butter and jelly sandwich. Break it down into a series of steps, one at a time.
- Write this procedure down as a numbered list (step 1, step 2…). Make sure you include all the steps, even ones you think are obvious.
- Note: in order to avoid wasting food, you might want to have your volunteer make half or quarter-sized sandwiches.
Instructions
- Give your written procedure and other materials to your volunteer. Your volunteer probably already knows how to make a peanut butter and jelly sandwich. Explain that you need them to pretend they have never made a sandwich before. You want them to do it by following your written directions exactly. They need to act like a robot and do whatever the instructions tell them to do—even if that results in making a mistake. They also should not assume any steps that are missing.
- Watch carefully as your volunteer follows the procedure. Do they make any mistakes? If so, at what step(s) of your program? Write down the step(s) and what problem(s) occurred.
- Now you need to "debug" your program by fixing the bugs, or errors, in the code. Based on your notes on any mistakes you observed, write a new version of your program and ask your volunteer to try again. Do they make the same mistakes as last time? Are there any new mistakes?
- Repeat the debugging process until your volunteer successfully makes a normal peanut butter and jelly sandwich.How many attempts did it take your volunteer to successfully make a sandwich?
What Happened?
You might have been very surprised to find out that at first, your volunteer failed to follow what you thought were a very simple set of instructions. There are a lot of tiny steps you take when making a sandwich that you might do automatically, without giving them much thought, and you could have forgotten to include these in your program. For example what if your program just said "spread the peanut butter on the bread"? That seems obvious enough to you. However, your volunteer might have done something silly, like used their fingers to spread peanut butter on the bread bag! But remember, your volunteer is a robot that needs very specific instructions. You did not specify that they should use a knife to spread the peanut butter, or that they needed to take a piece of bread out of the bag first!
There are a lot of other simple mistakes that can happen during this project—such as using the wrong end of the knife, not taking the lid off a jar first, putting the wrong sides of the pieces of bread against each other, etc. Each time you catch a mistake you will have to change your program to correct it and try again. It might take several attempts before you can fully debug your program!
Digging Deeper
Movies and TV are full of robots that can look, feel and act like humans. They can fly, talk, run, jump and do many other things. In the real world, however, robots are much more limited. Humans have gotten very good at building machines or making computer programs that can do one specific thing much better or faster than a human can. For example, we have computer programs that can beat humans at games such as chess, or TV game shows including Jeopardy. There are robotic arms that can rapidly assemble cars in a factory, much faster and more accurately than people can. You can even buy a robot vacuum cleaner that will automatically clean your floors!
Imagine, however, taking any of those robots and asking it to do a simple household task, such as folding your laundry or cooking dinner. They couldn't do it! They would need to be specifically built and programmed to perform those tasks. In this project focused on the programming side of this problem. A computer program is a set of instructions for a computer or robot to follow. Computers are very literal and will follow the instructions exactly, even if you make a mistake when writing the instructions. Things that might seem simple or obvious to a human, such as making a sandwich, will not be obvious at all to a robot. The robot has to be told exactly what to do. In this project you wrote a "program" for a person to make a peanut butter and jelly sandwich. As you may have discovered, this is more difficult than it sounds!
Note: building a robot that can do all the things a human hand can do—such as picking up objects with wildly different shapes without breaking them—is another entire problem on its own. In this project you will ask a volunteer to act like a robot, so you don't have to worry about building one. See the Additional Resources section for a link to a project on building a robotic hand.

Ask an Expert
For Further Exploration
- Try doing this project with verbal commands instead of written instructions.
- Try this project with other household tasks, such as washing dishes, folding laundry, or cleaning your room.