[SOLVED] Help with Golden Mirage


Hey everyone,
I’ve been stuck on golden mirage (https://codecombat.com/play/level/golden-mirage?) for a while now but I’m stumped, I could do the levels i the mountain before it fine but I can’t seem to do this one.
Here’s my current code:

while True:
    coins = hero.findItems()
    fakeCoins = []
    realCoins = []
    for coin in coins:
        for coin2 in coins:
            if coin2.value == coin.value:
        if not coin in fakeCoins:
    nearCoin = hero.findNearest(realCoins)
    if nearCoin:

It doensn’t really make sense but I can’t work out how to go about solving it, could anyone give me some hints about what code I should use to solve this level that would be great, Thanks. :grin:


It can’t really work because in that code you’ll end up comparing the same coin with itself so all coins are fake in the end

check the len of fakeCoins
that should give you a hand

for coin in coins:  # lets say coin = 0
        for coin2 in coins: # lets say coin2 = 0
            if coin2.value == coin.value:  # if coins[0].value == coins[0].value
                fakeCoins.append(coin) # put coins[0] in the array.


Thanks so much man, I’ve done the level now, Thanks! That was a really helpful description of the problem and it really cleared it up for me. :hugs:


@Deadpool198 Hi. I do not understand exactly how to get my character to compare two different coins. My character is just acting the same way as it did with the sample code. Here is my code:

# Collect 10 real coins.

while True:
    coins = hero.findItems()
    coinIndex = 0
    correctCoin = 0
    if coins and coinIndex < len(coins):
        # The following code will help you debug:
        coin = coins[0]
        if coin.value != correctCoin:
            hero.moveXY(coin.pos.x, coin.pos.y)
        # When ready, delete the previous code and solve.

P.S: The reason that I have been asking for so much help lately is that I have been unable to use CodeCombat for 8 months. I’m still getting warmed up again. Please excuse all of my pleas for help.


I’m afraid you’re not really going about this the right way, I also found this level probably one of the hardest levels I’ve done so far. What you’ve got to try and use is the double array stuff from levels like: “ice hunter”, “highlanders” and “the spy among us”. I can see from the leader-boards you’ve just done them, you have to apply those skills to this level.
Also, not trying to be self-righteous, but look at my code above and see what kind of techniques you need to use if you’re finding it very difficult, because my code used the right principles just with some technical mistakes.
I hope this helps you, and don’t worry about asking for help, It’s fine this level’s really hard, although just wait until you get to the glacier and see levels like “serpent savings” which are literally impossible, it suddenly says use the API, although I have no idea what an API is and it hasn’t explained it any level either, ah well sorry for that short rant, I think I need some coding help too. LOL)