Exemplo n.º 1
0
 def enemiesCloseBy(self, enemy, enemies):
     closeEnemies = [enemy]
     for enemy2 in enemies:
         if enemy2 != enemy:
             if util.distanceBetween(enemy2, enemy) < 3.0:
                 closeEnemies.add(enemy2)
     return closeEnemies
Exemplo n.º 2
0
 def gatherIntel(self):
     self.closeEnemies = set()
     bots = self.game.bots_alive
     flagPosition = self.game.team.flag
     for bot in bots:
         for enemy in bot.visibleEnemies:
             if util.distanceBetween(enemy, flagPosition) < self.radius and enemy.health > 0:
                 self.closeEnemies.add(enemy)
     if self.game.team.flag.position != self.game.team.flagScoreLocation:
         self.flagGone = True
     else:
         self.flagGone = False
Exemplo n.º 3
0
 def findClosestDefender(self, enemy, defenders):
     if len(defenders)==0:
         return None;
     if len(defenders)==1:
         return defenders[0]
     return reduce(lambda x,y: x if util.distanceBetween(enemy, x[0]) <= util.distanceBetween(enemy, y[0]) else y, defenders)
Exemplo n.º 4
0
 def getClosestEnemy(self):
     return reduce(lambda x,y: x if util.distanceBetween(x, self.bot.position) <= util.distanceBetween(y, self.bot.position) else y, self.bot.visibleEnemies)