def register_initial_state(self, game_state): self.start = game_state.get_agent_position(self.index) CaptureAgent.register_initial_state(self, game_state) if self.inference_initializer: self.inferences[:] = [ ExactInference(opponent, self.distancer, game_state) for opponent in self.get_opponents(game_state) ]
def register_initial_state(self, game_state): self.start = game_state.get_agent_position(self.index) CaptureAgent.register_initial_state(self, game_state) #two things which will be useful for future calculations self.mid_screen = game_state.data.layout.width/2 self.legal_positions = [p for p in game_state.get_walls().as_list(False) if p[1] > 1] #used for probabilistic tracking if self.inference_initializer: self.inferences[:] = [ExactInference(opponent, self.distancer, game_state) for opponent in self.get_opponents(game_state)]
def register_initial_state(self, game_state): """Handle initial setup of the agent to populate useful fields. Useful fields include things such as what team we're on. A distance_calculator instance caches the maze distances between each pair of positions, so your agents can use: self.distancer.get_distance(p1, p2) """ self.start = game_state.get_agent_position(self.index) CaptureAgent.register_initial_state(self, game_state)
def register_initial_state(self, game_state): """Handle initial setup of the agent to populate useful fields. Useful fields include things such as what team we're on. A distance_calculator instance caches the maze distances between each pair of positions, so your agents can use: self.distancer.get_distance(p1, p2) IMPORTANT: This method may run for at most 15 seconds. """ # Make sure you do not delete the following line. If you would like to # use Manhattan distances instead of maze distances in order to save # on initialization time, please take a look at # CaptureAgent.register_initial_state in capture_agents.py. CaptureAgent.register_initial_state(self, game_state)
def register_initial_state(self, game_state): """ This method handles the initial setup of the agent to populate useful fields (such as what team we're on). A distanceCalculator instance caches the maze distances between each pair of positions, so your agents can use: self.distancer.getDistance(p1, p2) IMPORTANT: This method may run for at most 15 seconds. """ ''' Make sure you do not delete the following line. If you would like to use Manhattan distances instead of maze distances in order to save on initialization time, please take a look at CaptureAgent.register_initial_state in captureAgents.py. ''' CaptureAgent.register_initial_state(self, game_state) ''' Your initialization code goes here, if you need any. ''' self.behaviour_state = 'Guard' self.set_center(game_state) self.eaten_food = 0 self.prev_food_state = self.get_food_you_are_defending(game_state) self.opponent_indices = self.get_opponents(game_state) self.team_indices = self.get_team(game_state) self.teammate_index = self.get_team(game_state)[:] self.teammate_index.remove(self.index) self.defence_destination = None self.attack_destination = None self.opponent_positions = {} self.opponent_previous_positions = {} self.opponent_detected = None for opponent_index in self.opponent_indices: self.opponent_positions[opponent_index] = None self.opponent_previous_positions[opponent_index] = None self.set_guard_mode()
def __init__(self, index, inferences, inference_initializer=False): self.inferences = inferences self.inference_initializer = inference_initializer CaptureAgent.__init__(self, index)
def register_initial_state(self, game_state): self.start = game_state.get_agent_position(self.index) CaptureAgent.register_initial_state(self, game_state)