Hello! I am playing Mad Maxer Gets Greedy (Sarven Desert), and something is wrong but I can’t quite place it. My hero moves to a random coin’s position about half the time, and then to a completely unrelated position the other half. Thank you in advance! Here’s my code:

```
while(true) {
var bestCoin = null;
var maxRating = 0;
var coinIndex = 0;
var coins = hero.findItems();
// Try calculating "value / distance" to decide which coins to get.
while (coinIndex < coins.length) {
var coin = coins[coinIndex];
if (coin.pos.x > 40) {
coinIndex++;
continue;
}
var distance = hero.distanceTo(coin);
var rating = coin.value / distance;
if (rating > maxRating) {
maxRating = rating;
bestCoin = coin;
}
if (bestCoin) {
hero.moveXY(bestCoin.pos.x, bestCoin.pos.y);
}
coinIndex++;
}
}
```