This is a workshop introducing participants to programming. It is based on a game in which participants will play the role of robots executing particular instructions. The main purpose is to understand that a computer only does exactly what it is told to do.
General Objective
Preparation time for facilitator
Competence area
Time needed to complete activity (for learner)
Name of author
Support material needed for training
Resource originally created in
Introduction
You can find the original workshop here (in French): https://members.loria.fr/MDuflot/files/med/robot.html
Note to facilitator: An area representing a landscape with obstacles will be needed. This can be printed on a large piece of paper made on a large sheet (i.e. fabric), or even drawn on the floor with chalk (design suggestion below)
Also required are small objects to place on the landscape: stones, flowers, leaves, etc. (actual or printed or plastic) Some example of programs to prints and laminate (see information below)
Step 1: Offline workshop – the idiot robot
1. Introducing the landscape
Here we are in the mountains: there’s a river, a volcano, a very dense forest, a lake, bridges… The robot must move around the landscape but stay at certain places. The forest, volcano, lake and river are therefore off limits.
2. Learning the language
To start, all participants are robots. Everyone stands on the sheet/drawing – each person in their assigned spot – and follows the instructions given by the facilitator, with a choice between, right, left, straight on or backwards. As soon as a player moves into a landscape feature (river, lake, forest or volcano) or leaves the area, they exit the game and wait to the side. Once everyone is out, you can start again. Things to be specified:
- One step means to move by point, not two
- No moving diagonally
- All players most always face in the same direction. They can move sideways but cannot turn their bodies.
- Players are robots, so they must execute instructions without changing them, even if they mean walking into obstacles.
- Review the meanings of left and right for those who may make a mistake. For children who don’t know left from right, you can use coloured ribbons for example: one step to the pink side, one side to the green side as proposed by Marie Duflot-Kremer
They will now have used algorithms, like a computer.
An algorithm is a series of instructions which solves one or multiple problems.
3. Executing programs in pairs
Set the departure point as shown on the map (at the bottom, 7th point from the left). All programs will start there. For each program we will divide the task between one participant who places the robot and another who plays the computer.
Execute programs 1 and 4. Note: the robot/computer only knows how to execute tasks attributed to them. It is not a question of making one extra step or adding an arrow along the way. The computer does not do this! We could even blindfold the ‘robot’ is necessary.
Programs 2 and 4 each have a ‘bug’. This will show that if the program is wrong, the computer will execute it calmly, going ahead with its task indiscriminately. It will have done nothing incorrect, as it was the programmer’s mistake. In each of the two programs, adding one arrow (to the right in program 2 and up in 4) can correct their errors. This shows that while a tiny error can create big problems (drowned robot), it can also be easily fixed. Here you can mention that every programmer makes mistakes in their programs (which are in general very long and complex) but that a good programmer will test/verify their work to find a correct bugs.
4. Changing the Instruction Set
Programs 1 to 4 move the robot around the landscape, but our robot can do more, such as collect specimens: stones, leaves, garbage, etc. Such variants can be implemented according to the available time and age of participants:
- place objects on the area as shown on the map and add the instruction ‘collect‘ which will mean the robot can pick up the objects situated on their fixed points,
- group consecutive identical arrows, for example, write ← x 4 instead of ← ← ← ←. This helps to avoid errors in counting arrows and makes the programs more compact (cf. program 5),
- replace the instructions ‘side step’ with instructions to turn 90º to the left or right (cf. program 6).
5. Writing programs
Once participants have understood the programming language, they will need to write their own (use a black or whiteboard if possible – it’s easier to correct errors that way that on paper). List of example programs:
- Collect any three objects,
- Return to the departure point carrying two objects,
- Collect three stones and go to the forest,
- Collect one of each type of object,
- Finish on a bridge with a flower, a stone and a leaf,
- Collect (in whichever order) two flowers and two leaves,
- Collect in this order, a leaf then a flower then a leaf then a flower (and nothing else).
By doing this you will notice that there are several programs possible for doing the same things. If you have time you can compare the programs that execute the same task in terms of efficiency (in IT we tend to think about complexity).
Step 2: LightBot
Propose that participants apply their new knowledge of programming to an exploration of the application: LightBot. This doesn’t require an internet connection. The application can be explored offline. There are often several solutions to clear each level. It can be interesting to compare the solutions found by each participant. You may want to divide the group into pairs for this step too. The programming notions you will encounter on LightBot are:
- Control sequential: orders (or instructions) executed by the program consecutively
- Procedures: blocks of preprogrammed code which can be inserted to save time and efficiency
- Loops: a code structure that repeats an instruction indefinitely (often as long as one or several conditions are respected)
- Debugging: executing and re-executing a program and testing solutions to correct errors in a computer program.
Variant
You can also use the ‘Coding out Loud‘ activity as an introduction but it is less adapted to an outdoor group activity.