social_dilemmas/envs/cleanup.py
def custom_action(self, agent, action):
        """Allows agents to take actions that are not move or turn"""
        updates = []
        if action == "FIRE":
            agent.fire_beam(b"F")
            updates = self.update_map_fire(
                agent.pos.tolist(),
                agent.get_orientation(),
                self.all_actions["FIRE"],
                fire_char=b"F",
            )
        elif action == "CLEAN":
            agent.fire_beam(b"C")
            updates = self.update_map_fire(
                agent.pos.tolist(),
                agent.get_orientation(),
                self.all_actions["FIRE"],
                fire_char=b"C",
                cell_types=[b"H"],
                update_char=[b"R"],
                blocking_cells=[b"H"],
            )
        return updates
Allows agents to take actions that are not move or turn
Allows agents to take actions that are not move or turn
Allows agents to take actions that are not move or turn
def custom_action(self, agent, action):
        updates = []
        if action == "FIRE":
            agent.fire_beam(b"F")
            updates = self.update_map_fire(
                agent.pos.tolist(),
                agent.get_orientation(),
                self.all_actions["FIRE"],
                fire_char=b"F",
            )
        elif action == "CLEAN":
            agent.fire_beam(b"C")
            updates = self.update_map_fire(
                agent.pos.tolist(),
                agent.get_orientation(),
                self.all_actions["FIRE"],
                fire_char=b"C",
                cell_types=[b"H"],
                update_char=[b"R"],
                blocking_cells=[b"H"],
            )
        return updates
def custom_action ( self , agent , action ) : updates = [ ] if action == "FIRE" : agent . fire_beam ( b"F" ) updates = self . update_map_fire ( agent . pos . tolist ( ) , agent . get_orientation ( ) , self . all_actions [ "FIRE" ] , fire_char = b"F" , ) elif action == "CLEAN" : agent . fire_beam ( b"C" ) updates = self . update_map_fire ( agent . pos . tolist ( ) , agent . get_orientation ( ) , self . all_actions [ "FIRE" ] , fire_char = b"C" , cell_types = [ b"H" ] , update_char = [ b"R" ] , blocking_cells = [ b"H" ] , ) return updates
Allows agents to take actions that are not move or turn
Allows agents to take actions that are not move or turn
"""Allows agents to take actions that are not move or turn"""
self
agent
action