i have a problem in Toil and Trouble.Witches win every time.My soldiers die. I can not make it work . Here is my code:
def chooseTarget(friend):
if friend.type == "archer":
if len(self.findByType("thrower")) > 0:
return friend.findNearest(self.findByType("thrower"))
elif len(self.findByType("witch")) > 0:
return friend.findNearest(self.findByType("witch"))
else:
return friend.findNearest(self.findEnemies())
elif friend.type == "soldier":
return friend.findNearest(self.findByType("witch"))
loop:
friends = self.findFriends()
for friend in friends:
# Use your chooseTarget function to decide what to attack.
chooseTarget(friend)
pass
help me plzzzzzzzzzzzzz! Thank you very much!