while True:
coinIndex = 0
hero.pos == hero.pos.x # remove
hero.pos == hero.pos.y # remove
coins = hero.findNearestItem() # change to hero.findItems()
# remove this section
if coins:
coin = coins[coinIndex]
hero.moveXY(hero.pos.x, hero.pos.y)
coinIndex += 1
pass
# replace with correct format just rewrite correctly
while coinIndex < coins.length
coin = coins[coinIndex]
if coin.value == ??? # What is the value for gold coin?
hero.moveXY(coin.pos.x, coin.pos.y)
coinIndex ++