def move_agent(self, state, slip_prob=0, dx=0, dy=0): ''' Args: state (TaxiState) dx (int) [optional] dy (int) [optional] Returns: (TaxiState) ''' if taxi_helpers._is_wall_in_the_way(state, dx=dx, dy=dy): # There's a wall in the way. return state next_state = copy.deepcopy(state) # Move Agent. agent_att = next_state.get_first_obj_of_class("agent").get_attributes() agent_att["x"] += dx agent_att["y"] += dy # Move passenger. taxi_helpers._move_pass_in_taxi(next_state, dx=dx, dy=dy) return next_state
def move_agent(self, state, slip_prob=0, dx=0, dy=0): ''' Args: state (TaxiState) dx (int) [optional] dy (int) [optional] Returns: (TaxiState) ''' if taxi_helpers._is_wall_in_the_way(state, dx=dx, dy=dy): # There's a wall in the way. return state next_state = copy.deepcopy(state) # Move Agent. agent_att = next_state.get_first_obj_of_class("agent").get_attributes() agent_att["x"] += dx agent_att["y"] += dy # Move passenger. taxi_helpers._move_pass_in_taxi(next_state, dx=dx, dy=dy) return next_state