# Build 4 decoys, then report the total to Naria. decoysBuilt = 0 gold = 0 while True: coin = hero.findNearestItem() if coin: # Collect the coin! gold += coin.value hero.moveXY(coin.pos.x, coin.pos.y) pass # Each decoy costs 25 gold. # If hero.gold is greater than or equal to 25: if hero.coin >= 25: # buildXY a "decoy" hero.buildXY("decoy", hero.pos.x - 5, hero.pos.y) # Add 1 to the decoysBuilt count. decoysBuilt += 1 if decoysBuilt == 4: # Break out of the loop when you have built 4. break pass hero.say("Done building decoys!") hero.moveXY(14, 36) # Say how many decoys you built. hero.say(decoysBuilt)```
Fix what? Your code, or the way you’ve posted it? Please include all of your code inside the triple back tick marks…
You got most of it in there, but not all of it. Because it’s not all formatted properly I can’t tell for sure, but it looks like a structure problem. Also, are you receiving an error? What happens when you run your code? Some information to work with would help us help you. Thank you.
I have resolved this problem. thank you
instead of defining your own gold variable use hero.gold