Skip to content

refactoring apply_environment_force #22

Description

@Yoshi-0921

Current code

def apply_environment_force(self, force):
    for agent_id, agent in enumerate(self.agents):

        # Check if there is a collision against other agents.
        next_pos = agent.xy + force[agent_id]
        for i, a in enumerate(self.agents):
            if agent_id == i:
                continue

            if all(next_pos == a.xy):
                force[agent_id] = np.zeros(2, dtype=np.int8)
                agent.collide_agents = True
                break

    ...

Should be ...

Refactor the code by using self.map.agents_matrix

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions