[SOLVED] Mad Maxer Level Help

Hello :slight_smile: I’ve been working on this level for some time, and I don’t know what’s wrong with my code… can somebody help?

loop:
    bestCoin = None
    maxRating = 0
    coinIndex = 0
    coins = self.findItems()
    
    while coinIndex < len(coins):
        coin = coins[coinIndex]
        distance = self.distanceTo(coin)
        value = coin.value
        coinIndex = coinIndex + 1 
        if value/distance > maxRating:
           maxRating = value
           bestCoin = coin 
    if bestCoin:
        self.moveXY(bestCoin.pos.x, bestCoin.pos.y)

Thanks :wink: ,
-Rachel

I think the main problem is here:

Try to write
While True:

1 Like

That worked :stuck_out_tongue_winking_eye: , thanks alot :slight_smile:
-Rachel

Congrats! I’m glad I could help!

1 Like

Also, can you change it to [SOLVED]?

1 Like

sure :slight_smile: (20cookies)

this is like the solution because it only has one mistake

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.