Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Friend and Foe Level Help [solved]

In the level Friend and Foe in the Backwoods Forest, I am having trouble figuring out the correct way to complete the level. Here is my code:

# Peasants and peons are gathering in the forest.
# Command the peasants to battle and the peons to go away!

while True:
    friend = hero.findNearestFriend()
    enemy = hero.findNearestEnemy()
    if friend:
        hero.say("To battle, " + friend.id + "!")
    # Now find the nearest enemy and tell them to go away.
    if enemy:
        hero.say("Go away, " + enemy.id + "!")
    

Any suggestions?

It works now ¯_(ツ)_/¯
I just exited out and went back in again, and it just started working. Sorry if wasted your time by making you read this

1 Like

No worries, we’re always happy to help.
-Danny