Programmes don’t need a computer – turn your students into coders and robots with just pens, paper and a stack of cups.
Coding and computer science are becoming important parts of the curriculum and the scientific world, but many of their principles can be explored without the need for computers. Using a predefined ‘robot vocabulary’, your students will figure out how to guide one another to accomplish specific tasks without discussing them first.
This activity teaches students the connection between symbols and actions, as well as the valuable skill of debugging. If time allows, there is an option to introduce functions at the end of the lesson.
Programming a robot
Start by asking the class if anyone has heard of robotics. Has anyone seen a robot or touched one? Does a robot really ‘hear’ you speak? Does it really ‘understand’ what you say? The answer to the latter question is: “Not in the same way as a person does.”
Robots operate using instructions: specific sets of things that they have been pre-programmed to do. To accomplish a task, a robot needs to have a series of instructions (sometimes called an algorithm) that it can follow. This activity teaches the students what it takes to make that happen.
- symbol key (1 per team)
- cup stack cards (1 set per team)
- disposable cups (6 or more per team)
- blank paper (1 per person)
- a pen or pencil (1 per person)
The symbol key and cup stack cards can be downloaded using the link in right hand column.
Pull out a copy of the symbol key or write the symbols on the board (figure 1). These are the only six symbols that the students will use for this activity. For this task, they will instruct their robot to build a specific cup stack using only these arrows.
First work through an example with the class. Show them the stack of cups illustrated in figure 2. Place your cups on the table where everyone can see them. Ask the class to give you the first instruction to create this stack. The correct answer is “pick up a cup”. When you pick up each cup, note that you should lift the cup above the highest cup already in the stack.
With your hand still in the air, ask for the next move. You may have to remind the class that one step forward is only half the width of a cup (see figure 3).
Once you’ve placed a single cup ask the class to help you write the symbols on the board so that you can ‘run the program’ later.
- Split class into teams (see Adjustments box for ideal sizes).
- Each team should choose one ‘robot’. Send the robots to the ‘robot library’ in another part of the classroom while the ‘programmers’ start coding. Robots can use their time in the library to practice cup stacking and make sure they understand the rules.
- Choose the cup stack cards for each team.
- Each team should create an algorithm for the robot to build the selected stack.
- The teams should then translate their algorithm into arrows, as described in the symbol key. The programmers should review their code to see if it makes sense.
- When the programmers have finished coding the creation of their cup stack, they can retrieve their robot.
- Once the robot returns, everyone in the team should remain silent. The robot reads the symbols from the cards and translates them back into movements.
- If there is a mistake in their code, the team can halt the programme and send the robot away before debugging their programme and asking the robot to re-run it.
Each time a team solves a challenge, the team members should choose a new robot to send to the library, and the team should be given a new (preferably more difficult) cup stack card.
Often, during this activity, students begin to write a shortened version of the instructions using numbers. For example ->x5 instead of ->->->->->. Discourage this practice, and remind students to stick only to the six symbols they are allowed. In the following activity, however, you can recognise the brilliance and foresight of students who tried that trick, and acknowledge that they independently discovered the need for functions.
An arrow with numbers is a clever way of indicating that we want to repeat a movement a specific number of times. By allowing repetition, we are essentially creating a new symbol to avoid re-using code unnecessarily. This is exactly the idea behind functions. Your students may come up with other shortcuts and functions.
Now that the class has these new functions, let them tackle one of the more challenging cup stack cards. Teams may work together if they need more cups to work with.
For primary school students
- Try this lesson together as one class. Let the students call out directions for the teacher to write down.
- If you have a classroom assistant, he or she can leave the room during programming, then return to perform the finished code.
- If there is time, swap roles so that the class assistant writes the instructions from the class and the teacher performs them.
For students aged 11–14 years old
- Keep team sizes between three and five students, depending on the personality of the students.
- Expect each student to want a turn, which will likely use the entire hour.
For students aged 14+ years old
- Limit teams to a maximum of four students, although groups of three are ideal.
- Once each student has been the robot there is usually still time for the activity on functions.
This activity was adapted from the Travelling Circuits lesson ‘My Robotic Friends’, developed by Thinkersmithw1 and published under the Creative Commons CC-BY-NC-SA license. The full lesson plan is hosted in English and Spanish on the Computer Science Education Week websitew2.