When i made the code it says that the line
southernEnemies = []
Is undefined?
This is the full code
# Summon one soldier for every ogre to the south of you!
# Don't count the ogres to the north!
# Accept an array of units as the parameter.
# Return only the units to the south of the hero.
def FindSouthernEnemies(enemies):
southernEnemies = []
for enemy in enemies:
if unit.pos.y < hero.pos.y:
# Add the unit to the array with: append()
southernUnits.append(unit)
return southernUnits
while True:
friends = hero.findFriends()
enemies = FindSouthernEnemies(enemies)
# Use findSouthernUnits to get enemies to the south.
# If there are more ogres south of you than friends.
if len(enemies) > len(friends):
# Then summon another "soldier".
hero.summon("soldier")