Talking to each other · Robot club · about 15 min
send(): a broadcast everyone hears; numbers into text.
[1 mark]You call send("hello"). Who hears it?
[1 mark]Which line sends your position in a way another robot can read?
send(f"at {x:.0f},{y:.0f}")send("at x,y")send(position())send(x, y)[1 mark]What does this program print?
x, y = 12.6, 30.4
print(f"at {x:.0f},{y:.0f}")[1 mark]Two robots are not understanding each other. Where do you look first?
[1 mark]You send a question. Is a reply guaranteed?
[1 mark]What type of Python value is every radio message?
Send hello, drive forward 20 cm, then send your position as at <x>,<y> in whole centimetres from the start.
# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()
# radio this to every other robot
send('hello')
# pause 1 s (the robot keeps doing what it was told)
wait(1)
print(messages())Plan your program here, then type it in and press Run.
facing <degrees>.tick <seconds> once a second for five seconds, using clock().json.dumps({"x": x, "y": y})), the way lesson 8.7 saved a model.