Friend and Foe (help needed)


#1

I can’t seem to solve the level “Friend and Foe” in Backwoods Forest. When I use my code(below) the peasants all get ready for battle and then the hero never says anything to the peons.

while True:
friend = hero.findNearestFriend()
enemy = hero.findNearestEnemy()
if friend:
hero.say("To battle, " + friend.id + “!”)

else:
    if enemy:
        hero.say("Go away," + "enemy.id")

#2

Please, look for the theme where you asked that question. I answered you there.


#3

This is what the code would be
[Please, don’t post solutions here]


#4

[Please, don’t post solutions here]


#5

Please try not to revive dead topics as they will unnecessarily push them back up to the top of the topic list. :slight_smile: