パイソンに挑戦するぞ!! その3
問題文
(forward(100))
forward(100)
(backward(200))
backward(200)
(left(90))
left(90)
(right(90))
right(90)
(speed(3))
speed(3)
(# robo done)
# robo done
(mp = MotorPair('A','B'))
mp = MotorPair('A','B')
(mp.move(3,'rotations',0,50))
mp.move(3,'rotations',0,50)
(mp.move_tank(3,'rotations',-50,50))
mp.move_tank(3,'rotations',-50,50)
(cs = ColorSensor('D'))
cs = ColorSensor('D')
(fs = ForceSensor('B'))
fs = ForceSensor('B')
(while true:)
while true:
(color = get_color())
color = get_color()
(while fs.is_pressed() == false:)
while fs.is_pressed() == false:
(count = count + 1)
count = count + 1
(mp.start(0,30))
mp.start(0,30)
(mp.stop())
mp.stop()
(for num in range(5):)
for num in range(5):
(while count < 4:)
while count < 4:
(penup())
penup()
(pendown())
pendown()
(ms = Motor('C'))
ms = Motor('C')
(ms.run_for_rotations(4.5,50))
ms.run_for_rotations(4.5,50)
(ms.run_for_degrees(45,60))
ms.run_for_degrees(45,60)
(wait_for_seconds(5))
wait_for_seconds(5)
(hub.speaker.beep(60,2))
hub.speaker.beep(60,2)