Hi everyone, I tried this code with the “+2m/s boots” but still couldn’t get enough coins
while True: bestCoin = None maxRating = 0 coinIndex = 0 coins = hero.findItems() # Try calculating "value / distance" to decide which coins to get. while coinIndex < len(coins): coin = coins[coinIndex] rating = coin.value / hero.distanceTo(coin) if rating > maxRating and coin.pos.x < 38: bestCoin = coin coinIndex += 1 if bestCoin: hero.moveXY(bestCoin.pos.x, bestCoin.pos.y)
So I “patched” the if command line into
if rating > maxRating and coin.pos.x < 38 and hero.distanceTo(coin) < 20: and it worked.
But I feel like this kinda is “cheating”. Is there another way to fix my original code?