- Joined
- Dec 1, 2024
- Messages
- 1
- Reaction score
- 0
the code below is supposed to solve the the rain2.wld world from the cs1robots module. But right now the robot is not finishing its path. Instead it is just going straight. Can anyone do it?
from cs1robots import *
load_world("rain2")
h = Robot(avenue=9, street=3, orientation='S', beepers=10)
h.set_trace("blue")
h.set_pause(0.3)
while not h.on_beeper():
if h.right_is_clear():
h.drop_beeper()
h.move()
if h.front_is_clear():
h.move()
elif h.left_is_clear():
h.turn_left()
from cs1robots import *
load_world("rain2")
h = Robot(avenue=9, street=3, orientation='S', beepers=10)
h.set_trace("blue")
h.set_pause(0.3)
while not h.on_beeper():
if h.right_is_clear():
h.drop_beeper()
h.move()
if h.front_is_clear():
h.move()
elif h.left_is_clear():
h.turn_left()