[SOLVED] Level:borrowed sword help pls

hey what is going on?

how can I do it anyways?

best = None 
bestHealth = 0
while True:
    friends = hero.findFriends()
    enemies = hero.findEnemies() 
    while True:
        for x in len(friends):
            friends = hero.findFriends()
            friend = friends[x]
    for i in len(enemies):
        enemies = hero.findEnemies()  
        enemy = enemies[i] 
        if enemy.health >= bestHealth: 
            best = enemy 
            bestHealth = enemy.health 
    if best:
        for friend in friends:
            hero.command(friend, "attack", best)              

Can you send me a link to the level to refresh my memory with it?

Andrei

1 Like

Why did you delete the comments as they are meant to guide you to the solution? (PS I lost my subscription so without the comments I will not be able to help you unfourtunally :cry:)

Andrei

Do you mean this?

#For this level, your hero doesn’t fight.
#Command your archers to focus fire on the enemy with the most health!
while True:
    friend = hero.findFriends()
    enemies = hero.findEnemies()
    best=None
    bestHealth=0
    for i in enemies:
        enemy = enemies[i]
        if enemy.health >= bestHealth:
        best = enemy
        bestHealth = enemy.health

    if best:
        friend = hero.findFriends()
        hero.command(friend, "attack", best)

Yes, but I do not remember the level too well unfourtunaly so I can not help you much. :crying_cat_face:

Andrei

okay, I’ve solved it. Thx

1 Like

Then congratulations for completing the level! :partying_face:

Andrei