Programming a robot to make you a peanut butter sandwich

Publication date: November 2, 2020

by Ana Cristina Ribeiro, Teacher in Portugal

Developing code activities in the classroom is challenging! But what to do when good internet access is not fully available?

This is a disconnected activity. It can be done at home or applied in the classroom. Students can work in groups or individually. It is a good approach to computational thinking for students that do not yet master visual programming languages and are eager to start coding. With this unplugged activity, students will take the first steps by decomposing a problem. The activity is suitable for any age, across all disciplines and without language barriers. It is within reach to anyone.

The goal is to develop an algorithm to program a robot to make a sandwich. The algorithm is written using a sequence of phrases corresponding to the various actions that the robot must perform. For example: open the jar, take the lid off, take on the knife, etc. In the second phase, the algorithm is tested by another student who, playing the role of the robot, tries to follow the instructions sequentially.

At first, students consider this a quite easy challenge, but when they test the algorithm, they start encountering difficulties and find errors in the instructions. They find bugs in the algorithm.

Now, here we go to the next phase: debugging, that is, an attempt to improve the algorithm. The activity takes place in two alternating phases: testing and debugging until the algorithm consists of a correct sequence.

The activity takes place through the four steps of computational thinking: Decomposition of the problem, Pattern recognition, Abstraction and Algorithm design.

This activity is designed to promote the development of computational thinking, problem-solving, as well as other skills, such as collaboration, analytical and communication abilities across all disciplines, as well as confidence and perseverance. This activity promotes critical thinking since students must observe, collect information, analyse, reflect on it before taking action.

If you’d like to try out this activity, you can use the activity sheet available here.

Students are developing skills while having a lot of fun!