Here is my code
loop:
maxDistance = 0
enemyIndex = 0
enemies = self.findEnemies()
# Look at all the enemies to figure out which one is farthest away.
while enemyIndex < len(enemies):
target = enemies[enemyIndex]
enemyIndex += 1
# Is this enemy farther than the farthest we've seen so far?
distance = self.distanceTo(target)
if distance > maxDistance:
maxDistance = distance
farthest = target
if farthest:
# Take out the farthest enemy!
self.attack(farthest)
farthest = None
I don’t know what is wrong. It tries to attack the flying enemy, but can’t. He gives up on that and starts to kill the witches and dies.