eugenevinitsky / sequential_social_dilemma_games

Repo for reproduction of sequential social dilemmas
MIT License
387 stars 132 forks source link

Agent ego map is missing their view at initialization #91

Closed eugenevinitsky closed 5 years ago

eugenevinitsky commented 5 years ago

Currently the agent initialization script looks like this: map_with_agents = self.get_map_with_agents()

    for i in range(self.num_agents):
        agent_id = 'agent-' + str(i)
        spawn_point = self.spawn_point()
        rotation = self.spawn_rotation()
        grid = util.return_view(map_with_agents, spawn_point,
                                HARVEST_VIEW_SIZE, HARVEST_VIEW_SIZE)
        agent = HarvestAgent(agent_id, spawn_point, rotation, grid)
        self.agents[agent_id] = agent

However, when self.get_map_with_agents() is called, the map is currently empty. Hence, at the time of their initialization, their grid may not be correct.

@natashamjaques , I've assigned this to you as this is code you have written so you're more familiar with it than I am.

eugenevinitsky commented 5 years ago

This potential bug probably never gets triggered because reset is always called to start.

natashamjaques commented 5 years ago

Adding a check in case get_map_with_agents gets called before agents are initialized properly with a position. In that case, they just aren't added to the map, but it still returns what does exist of the map.