Competing · Robot club · about 15 min
A mat that fills up: seeing trails, turning early, keeping to the outside, and turning without stopping.
[1 mark]In Light Cycles you want a moment to think. What happens if you stop?
[1 mark]Which line turns a corner without stopping?
drive(35, 0, 80)stop() then turn_right(40, angle=90)turn_right(40)backward(30) then turn_left(40)[1 mark]Which of these keep you alive longer in Light Cycles?
Tick every answer that is true.
[1 mark]What does this program print?
import math trail = [(0, 30), (10, 30), (20, 30)] x, y = 8, 12 closest = min(math.hypot(px - x, py - y) for px, py in trail) print(round(closest, 1))
[1 mark]What does this program print?
found = None
print("line ahead?", bool(found))
found = [200, 5]
print("line ahead?", bool(found))[1 mark]Does info()['trails'] include your own trail?
Two trails lie across the mat, each with a gap at one end, and the gaps are at opposite ends. Drive from the start to the green zone at the top without touching a trail. In this task the trails are low walls, 6 cm high, so the depth sensor sees them and the line detector does not.
from bugbot import *
connect()
while position()[1] < 85:
forward(45)
wait(0.1)
stop()Plan your program here, then type it in and press Run.
distance() or scan() to spot the trail ahead and steer for the gap rather than driving a fixed path.drive() only, never stopping.