[SOLVED] Uneasy Truce help! {Python}

Here is the 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 findSouthernUnits(units):
    southernUnits = []
    for unit in units:
        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 = hero.findEnemies()
    # Use findSouthernUnits to get enemies to the south.
    findSouthernUnits(enemies)
    # If there are more ogres south of you than friends.
    if len(enemies) > len(friends):
        # Then summon another "soldier".
        hero.summon("soldier")

I followed the instructions, and my soldiers are busting the mine and angering the yetis! Please help! I shall summon @Deadpool198 and @Lydia_Song.

Guys? (20 characters)

This is the only thing I see that needs to be changed.
You have to replace this with
enemies = findSouthernUnits(enemies)
Lydia

1 Like

ok, thanks, it works!

Glad to help! Congrats on passing the level! :partying_face:
Lydia

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.