Seeing more · Robot club · about 20 min
Two sightings give a velocity: give way to a robot crossing your path.
[1 mark]Robot 102's bearing sweeps from -36 to 33 degrees while its distance only goes from 58 cm down to 40 cm and back out. What is it doing?
[1 mark]What does this program print?
last = None
for bearing in [-30.0, -20.0, -8.0, 5.0, 18.0]:
if last is not None:
print(bearing, "coming" if abs(bearing) < abs(last) else "leaving")
last = bearing[1 mark]The first give way rule stops whenever robot 102 is close and in front. What is wrong with it?
[1 mark]The rule is tags and tags[0][3] < 30 and abs(bearing_of(tags[0][1])) < 35. Robot 102 is 25 cm away at a bearing of -40. Does the robot stop?
abs makes the bearing 0[1 mark]When robot 102 is out of view, the prediction code sets last = None. Why?
None makes the robot stop[1 mark]waited goes up by 1 on every tick the robot stops, at ten ticks a second. At the end waited is 23. What does waited / 10 print?
[1 mark]What does the general version of prediction, used by cars and ships, do?
Tick every answer that is true.
Reach the green zone without touching the red robot.
# the two lines every program starts with: the commands, then the robot from bugbot import * connect() # drive forward at 50 for 80 cm, then stop forward(50, distance=80)
Plan your program here, then type it in and press Run.
coming or leaving each time you see the robot.