Hi,
YOUR written code hero.attack(enemy) - gives me a mistake. I added my own code and it doesn’t work.
The hero doesn’t attack enemies. Because hero.attack(enemy) is not functioning.
while True:
enemy = hero.findNearestEnemy()
if enemy:
if enemy.type != (“peon”):
hero.attack(enemy)
item = hero.findNearestItem()
if item:
# Gather the item only if the type is NOT equal to “poison”.
if item.type == (“poison”):
hero.pick(item)
pass