#FORMAT python from pyrobot.brain import Brain class Avoid(Brain): def wander(self, minSide): # if approaching an obstacle to the left side, turn right if min([s.distance() for s in self.robot.range["front-left"]]) < minSide: self.move(0,-0.3) # if approaching an obstacle to the right side, turn left elif min([s.distance() for s in self.robot.range["front-right"]]) < minSide: self.move(0,0.3) else: # go forward self.move(0.5, 0) def step(self): self.wander(1) def INIT(engine): return Avoid('Avoid', engine)