My character collects one coin and stops
while hero.time < 20:
# Collect coins
hero.say("I should pick up a coin")
items = hero.findItems()
bestItem = None
bestValue = 0
itemsIndex = 0
while itemsIndex < len(items):
item = items[itemsIndex]
if item.value / hero.distanceTo(item) > bestValue:
bestItem = item
bestValue = item.value / hero.distanceTo(item)
itemsIndex += 1
while bestItem:
hero.move(bestItem.pos)
pass