def __init__(self, leader, antlist): """ leader: the ants on which many computations might be based. antlist: a list of ants to add to this aggregator """ self.planner = group_planner.GroupPlanner(leader.world.map) self.bot = leader.bot self.world = leader.world self.log = pezz_logging.TurnAdapter(logger, {"ant": self}, self.bot) self.attackradius = int(sqrt(self.world.attackradius2)) self.attackradius2 = self.world.attackradius2 global aggregator_id self.id = aggregator_id aggregator_id += 1 self.controlled_ants = set() self.leader = leader for ant in antlist: self.control(ant) self.last_turn = -1 self.destroyed = False self.centroid = None self.grouping = 0.0 self.previous_poses = None self.current_poses = None self.need_a_step = None self.bot.add_aggregator(self)
def __init__(self, pos, bot, world, init_state): """ Parameters: pos: the (row,col) initial location of the ant. bot: the bot object world: the Ant object init_state: a string representing the initial state. Usually provided by a subclass. """ super(SingleAnt, self).__init__(init_state) self.pos = pos self.bot = bot self.world = world self.mover = bot.mover self.plan_cache = {} self.plan_cache_age = 0 self.max_cache_age = 10 self.current_heading = 'n' self.planner = castar global ant_ids self.id = ant_ids ant_ids += 1 #logging structure self.log = pezz_logging.TurnAdapter( logger, {"ant":self}, self.bot )
def __init__(self, world, bot): self.world = world self.bot = bot self.ants = [] #logging structure self.log = pezz_logging.TurnAdapter(logger, {"ant": "WarriorDispatcher"}, self.bot)
def __init__(self, world, bot): self.world = world self.orders = {} self.notmoving = set() self.depends_on = {} self.moving = set() self.all_ants = set() #logging structure self.log = pezz_logging.TurnAdapter(logger, {"ant": "Mover"}, bot) self.pos_mapping = {}
def __init__(self, world, bot): self.world = world self.bot = bot #logging structure self.log = pezz_logging.TurnAdapter(logger, {"ant": "DefenderDispatcher"}, self.bot) self.assigned_hills = set() self.my_hills = set() self.ants = []
def __init__(self, world, bot): #TODO ant a location for each hill self.world = world self.food_tracking = {} self.allocated_food = set() self.bot = bot self.ants = [] self.food_range = 2 * int(sqrt(world.viewradius2)) + 1 #logging structure self.log = pezz_logging.TurnAdapter(logger, {"ant": "ExplorerDispatcher"}, self.bot) self.log.info("Food range is %d", self.food_range) self.availability_map = None self.mask = np.ones(self.world.map.shape, dtype=np.int8, order="C") self.masked_availability = None
def __init__(self): self.ants = [] self.world = None self.turn = 0 #logging structure self.log = pezz_logging.TurnAdapter( logger, {"ant":"Bot"}, self ) self.enemy_hills = set() self.aggregators = set() self.executed_aggregators = 0 self.postloop_time = 10. self.average_ant_time = 0.5 self.executed_ants = 0 self.aggregators_times = [] self.explored_map = None self.prev_visible = -1