예제 #1
0
파일: part2.py 프로젝트: Occy88/MultiAgents
    def decide(self):
        # default messge to broadcast in case anything is required?
        print('------------', 'AGENT: ', self.name, '---------------')
        self.message = {}
        self.action = action.idle()
        # Conditions to Find Grid Size
        if self.grid_size < 0:
            FindGridSizeMind.run(self)
        if self.grid_size > 0:
            # order by inverse precedence (most important last (for any classes that affect actions)
            # keeps the current state of the map and the
            # age (number fo cycles since update)
            MappingMind.run(self)
            # Places a value on each cell by how long ago it was explored and cubes it (older exponentially more expensive)
            # and if there are other agents that are closer there is a penalty.
            # sums each cell to the value of it's surrounding cells (how much does the robot wanna go there)
            # Robot targets the closest most expensive cell
            GreedyExplore.run(self)
            # If there is a cell to clean, checks if there are other bots
            # closer that are able to clean it, if there are then abandons cleaning
            Cleaner.run(self)
            # Resolves a face to face argument, forces the next to moves to be a turn and
            # forward to the right if possible.
            # Follower.run(self
            Plunger.run(self)
            # goes to the specified self.target_position, viea the fewest
            # possible moves, prioritises x first then y.
            GoToPosition.run(self)

        return self.validate_actions()
예제 #2
0
    def max_edge_found(self):
        """
        Max edge has been found,
        set the max edge,
        deactivate

        :return: action (idle, broadcast grid size)
        """
        self.grid_size = max(self.position) + 1
        self.active = False
        self.action = action.idle()
        self.message.update({'grid_size': self.grid_size})
예제 #3
0
    def decide(self):
        # default messge to broadcast in case anything is required?
        self.message = {}

        if not self.active:
            self.action=action.idle()
            return self.validate_actions()
        if self.grid_size < 0:
            self.find_grid_size()


        return self.validate_actions()
예제 #4
0
    def __init__(self):
        self.grid_size = -1
        # each position in the grid has a structure of:
        self.grid = []
        # the agent deactivates itself if it no longer requires to move
        self.active = True
        # message to broadcast at each turn
        self.message = {}
        self.action = action.idle()

        self.observation = []
        self.position = (-1,-1)
        self.colour = 'none'
        self.orientation = 'none'
        self.dirt = 'none'
        self.name = 'none'
        # MESSAGES
        # LOAD THE MESSAGES
        self.messages = []
예제 #5
0
파일: part2.py 프로젝트: Occy88/MultiAgents
    def __init__(self):
        self.grid_size = -1
        self.message = {}
        self.action = action.idle()
        self.observation = []
        self.position = (-1, -1)
        self.colour = 'none'
        self.orientation = 'none'
        self.dirt = 'none'
        self.name = 'none'
        # MESSAGES
        # LOAD THE MESSAGES
        self.messages = []

        FindGridSizeMind.__init__(self)
        # MAPPING MAP MAX BANDWIDTH OF 80
        MappingMind.__init__(self)
        GreedyExplore.__init__(self)
        Cleaner.__init__(self)
        GoToPosition.__init__(self)
        Plunger.__init__(self)