Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def main():
- robot = Robot("outB", "outC")
- time = current_time()
- while True:
- directions = robot.process_colors(robot.register_colors(robot.forward_color()))
- print(directions)
- if len(directions) == 0:
- continue
- if Robot.WIN in directions:
- break
- print(directions)
- if len(directions) > 1 and Robot.D_BACKWARD in directions:
- directions.remove(Robot.D_BACKWARD)
- print(directions)
- print("----")
- time2 = current_time()
- while time < time2:
- angle = robot.gyroscope.value()%360
- if 45 <= temp < 135:
- dir = "E"
- elif 135 <= temp < 225:
- dir = "S"
- elif 225 <= temp < 315:
- dir = "W"
- else:
- dir = "N"
- robot.textMap += dir
- time += 100
- robot.rotate_to_direction(random.sample(directions, 1)[0])
- time = current_time()
- robot.forward(duration=500)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement