I try to optimize the next movement.
First move to gold, them silver, and bronze.
But the program breaks at first gold.
It said there is a error in hero.moveXY(gold.pos.x, gold.pos.y)
I think method this.findNearest(units) can not work with this.findItems()
Thanks a lot.
golds = []
silvers = []
while True:
# Find coins and/or attack the enemy.
# Use flags and your special moves to win!
items = hero.findItems()
for item in items:
if item.value == 3:
golds.append = item
elif item.value == 2:
silvers.append = item
else:
pass
if golds:
hero.say("Oro")
gold = hero.findNearest(golds)
hero.moveXY(**gold.pos**.x, gold.pos.y)
elif silvers:
hero.say("Plata")
silver = hero.findNearest(silvers)
hero.moveXY(silver.pos.x, silver.pos.y)
else:
hero.say("Bronce")
item = hero.findNearestItem()
hero.moveXY(item.pos.x, item.pos.y)