Hoarding Gold Level - Not sure what I'm missing


#1

Hi there, I am having some trouble with the Hoarding Gold challenge on the desert level. I am not sure what I am missing in my code. Every time when I run the program, it goes to pick up the very first coin then stops the program on the line “self.moveXY(x, y)”. What am I missing?

# Collect 25 gold, and then tell Naria the total.
# Use break to stop collecting when totalGold >= 25.
totalGold = 0
loop:
    [...]
    self.moveXY(x, y)
    [...]
    self.say(totalGold)
    [...]
[...]

#2

Nevermind, I figured it out! I had to remove the

self.say(totalGold) 

in the first part of the loop because that was triggering Naria to tell me it’s not enough, and end the level.


#3

[Edit - Haha, we were posting at the same time, Glad you got it figured out.]

If you look at what happens when it stops . . . you will see that it thinks you are done and Narya is saying, “3? That is not enough gold.”

Your saying stuff every time you get a coin is causing the problem. Remove it and see what happens.


#4

Thanks for your quick reply! (I see you like to not do anything but play or help people play CodeCombat on your Memorial Day weekend, too :wink:)