Competing · Robot club · about 14 min
Practice, replay and the results board: why you lost, and the fast-then-careful pattern that wins.
[1 mark]What does this program print?
for gap in [100, 30, 10]:
speed = max(20, min(90, gap * 1.2))
print("gap", gap, "-> speed", round(speed))gap 100 -> speed 90 gap 30 -> speed 36 gap 10 -> speed 20
100 x 1.2 = 120 is capped at 90, 30 x 1.2 = 36 is inside the limits, and 10 x 1.2 = 12 is raised to the floor of 20.
[1 mark]After losing a race, put the three things to look at in order.
Number the lines 1 to 3 to put them in the right order.
Where did the time go?Did the robot do what you meant?What did the bots do differently?Did the robot do what you meant? Where did the time go? What did the bots do differently?
Most losses are a program doing exactly what it was told, so watch the replay first.
[1 mark]What are the built-in bots for?
[1 mark]Which pattern wins nearly every game with a target?
[1 mark]Your robot stops inside the bay but facing 14 degrees off. What should you add?
wait before stopping[1 mark]With speed = max(20, min(90, gap * 1.2)), below what gap does the speed stop falling and sit at 20? Give your answer to one decimal place.
Drive into the bay and stop inside it, facing the way you started, within 10 degrees. Being in the bay is not enough: finish straight.
from bugbot import *
connect()
forward(60, distance=35)
stop()
print("heading", heading())The hint students can ask for: Drive in fast while it is far, creep at the end, and check heading() before you stop: a quarter of a turn out is a fail.
from bugbot import *
connect()
forward(70, distance=25)
while position()[1] < 52:
forward(25)
wait(0.1)
stop()
print('heading', heading())
Any program that meets the task's checks is marked correct in the simulator; this is one way, not the only way.