Пример #1
0
    def handle_turn(self, world_state, events):
        from simulation.action import MoveAction
        from simulation import direction

        self.location = world_state.my_avatar.location
        directions = (direction.EAST, direction.SOUTH, direction.WEST, direction.NORTH)
        direction_of_other_avatar = next((d for d in directions if world_state.map_centred_at_me.is_on_map(self.location + d) and world_state.map_centred_at_me.get_cell(self.location + d).avatar), None)
        if direction_of_other_avatar:
            from simulation.action import AttackAction
            return AttackAction(direction_of_other_avatar)
        import random
        direction_to_other_player = self.direction_to(next(a.location for a in world_state.avatar_manager.avatars if a != world_state.my_avatar))
        if direction_to_other_player:
            return MoveAction(random.choice(directions + ((direction_to_other_player,) * 10)))
        return MoveAction(random.choice(directions))
Пример #2
0
    def handle_turn(self, state):
        next_action = MoveAction(direction.EAST)

        # Reset event log
        self.events = []

        return next_action
Пример #3
0
 def handle_turn(self, world_state, events):
     import random
     from simulation.action import WaitAction
     
     self.world_state = world_state
     
     if world_state.map_centred_at_me.get_cell(world_state.my_avatar.location).generates_score:
         return WaitAction()
     
     possible_directions = self.get_possible_directions()
     directions_to_emphasise = [d for d in possible_directions if self.is_towards(d, self.get_closest_score_location())]
     return MoveAction(random.choice(possible_directions + (directions_to_emphasise * 5)))
    def handle_turn(self, avatar_state, world_state):
        from simulation.action import MoveAction
        from simulation import direction
        self.avatar_state = avatar_state

        self.location = self.avatar_state.location
        directions = (direction.EAST, direction.SOUTH, direction.WEST,
                      direction.NORTH)
        direction_of_other_avatar = next(
            (d for d in directions if world_state.is_visible(self.location + d)
             and world_state.get_cell(self.location + d).avatar), None)
        if direction_of_other_avatar:
            from simulation.action import AttackAction
            return AttackAction(direction_of_other_avatar)
        import random

        direction_to_other_player = self.direction_to(
            next(cell.location for cell in world_state.all_cells()
                 if cell.avatar and cell.location != avatar_state.location))
        if direction_to_other_player:
            return MoveAction(
                random.choice(directions +
                              ((direction_to_other_player, ) * 10)))
        return MoveAction(random.choice(directions))
    def handle_turn(self, avatar_state, world_state):
        from simulation.action import MoveAction
        from simulation import direction
        import random
        from simulation.action import WaitAction

        self.world_state = world_state
        self.avatar_state = avatar_state

        if world_state.get_cell(avatar_state.location).generates_score:
            return WaitAction()

        possible_directions = self.get_possible_directions()
        directions_to_emphasise = [
            d for d in possible_directions
            if self.is_towards(d, self.get_closest_pickup_location())
        ]
        return MoveAction(
            random.choice(possible_directions + (directions_to_emphasise * 5)))
Пример #6
0
 def handle_turn(self, world_map=None, avatar_state=None):
     return MoveAction(self, self._direction.dict)
Пример #7
0
 def handle_turn(self, state_view):
     return MoveAction(self, self._direction.dict)
Пример #8
0
    def handle_turn(self, world_view, events):
        from simulation.action import MoveAction
        from simulation.direction import ALL_DIRECTIONS
        import random

        return MoveAction(random.choice(ALL_DIRECTIONS))
Пример #9
0
 def __init__(self, player_id, initial_location):
     super(CustomLiveDummy, self).__init__(player_id, initial_location)
     self._next_action = MoveAction(self, EAST.dict)