[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: