Hello~ I’m on Shine Getter(https://codecombat.com/play/level/shine-getter?) and I can’t seem to understand exactly what is wrong with my code
.
# 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
im pretty sure you define before but @AnSeDra would know
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
But it still says coins isn’t defined 
-Rachel
try flipping the
coinIndex = 0
hero.findNearestItem()
and you dont need this
pos = coin.pos
x = pos.x
y = pos.
for this
hero.moveXY(x, y)
put
hero.moveXY(coin.pos.x, coin.pos.y)
I think I figured out where the “coin” isn’t defined, and I was able to complete the level
. Thanks for your help!
-Rachel
your welcome i hlp people whenever i can
(if i can)