# To grab the most gold quickly, just go after gold coins.
while True:
coinIndex = 0
hero.findNearestItem()
while coinIndex < len(coins):
if coin.value == 3:
pos = coin.pos
x = pos.x
y = pos.y
hero.moveXY(x, y)
coinIndex += 1

It says coins isn’t defined, but I don’t know where I need to define coins.
-Rachel

I looked at the hints, and now I’m left with this code:

# To grab the most gold quickly, just go after gold coins.
while True:
coinIndex = 0
hero.findNearestItem()
while coinIndex < len(coins):
coin = coins[coinIndex]
hero.moveXY(coin.pos.x, coin.pos.y)
coinIndex += 1
if coin.value == 3:
pos = coin.pos
x = pos.x
y = pos.y
hero.moveXY(x, y)
coinIndex += 1