Labyrinth
This activity belongs to the GeoGebra book Attractive projects.
2D project: create robots that adapt to the environment.
In this last example, the robot (green point) does not have any information about the shape of the labyrinth. It only detects if there is free space to its right (in which case it turns to the right to stick to the right wall) or if there is an obstacle in front (in which case it turns to the left).
This simple rule is enough to not detach from its right wall and get out of the labyrinth (although not in the shortest possible way). To do this, two instructions are enough in the script of the robot:
- SetValue(v, If(dPD> 8, vn, If(dPA <2, -vn, v)))
- SetValue(P, P + v)
Author of the construction of GeoGebra: Rafael Losada