- Understanding the concept of algorithms.
- Ability to translate behaviour into machine readable code.
1. Introduction: The task is to give instructions to a robot to successfully follow the course shown on the slides. Here, the workshop awaits, where it can be repaired. The robot knows the following commands:
- Go straight ahead (x steps)
- Turn left (x times 90°)
- If X, then Y, otherwise Z
- Find here a Template in A4
2. Assign who will write the commands on the flipchart, and one robot, which executes the commands in front of the group as a simulation, should be determined.
3. The group now gives the instructions, which should lead the robot to the goal (“Go straight ahead 3 steps”).
To develop pseudo-codes from this, the game leader encourages the group to use abbreviations, which the note-taker writes down on the flipchart.
- For example, the command “walk straight ahead 3 steps” might look like this: GA (3).
- This is followed by “turn left 5 times 90°” or simplified: TL (5).
- By stringing the simplified commands together, the code is now created: GA (3) + TL (5) + …
4. Another challenge arises at the bridge. The robot naturally strives for the shorter way over the bridge, which closes and opens independently. At this point the command “if X, then Y, otherwise Z” is needed. (= If situation X is given, follow the actions defined in Y, if situation X is not given, follow the actions defined in Z). For this, the letters X,Y and Z must be defined first. An example of this can be found in the next point.
5. The solutions of the course are:
- X = bridge above (if X = “bridge below”, the definitions of Y and Z interchange)
- Y = TL (1) + GA (4) + TL (3) + GA (6) + TL (3) + GA (8)
- Z = GA (6) + TL (3) + GA (4)
- total: GA (6) + TL (1) + GA (2) + TL (3) + GA (2) + TL (3) + GA (2) + if X, then Y, otherwise Z
Spoken: Go 6 steps straight ahead; turn 1 time to the left; go 2 steps straight ahead; turn 3 times to the left; go 2 steps straight ahead; turn 3 times to the left; go 2 steps straight ahead; if bridge is up, then turn 1 time to the left, go 4 steps straight ahead, turn 3 times to the left, go 6 steps straight ahead, turn 3 times to the left, go 8 steps straight ahead, otherwise go 6 steps straight ahead; turn 2 times to the left, go 4 steps straight ahead.