Hello 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 ,
-Rachel