December 2019
Intermediate to advanced
368 pages
11h 10m
English
The position of the maze-solver agent within a maze needs to be updated in each simulation step after receiving the corresponding control signals from the controller ANN. The following code is executed to update the position of the maze-solver agent:
def update(self, control_signals): if self.exit_found: return True # Maze exit already found self.apply_control_signals(control_signals) vx = math.cos(geometry.deg_to_rad(self.agent.heading)) * \ self.agent.speed vy = math.sin(geometry.deg_to_rad(self.agent.heading)) * \ self.agent.speed self.agent.heading += self.agent.angular_vel if self.agent.heading > 360: self.agent.heading -= 360 elif self.agent.heading < 0: self.agent.heading += 360 new_loc = geometry.Point( x = ...
Read now
Unlock full access