I can´t pass the SarvenTreasure. I need help because I pick up only 134 coins.

This is my code:

// Collect 150 gold while evading ogres with teleporters.

// If you win, it gets harder (and more rewarding).

// If you lose, you must wait a day before you can resubmit.

// Remember, each submission gets a new random seed.

// Returns Best Coin to Move Toward

while(true) {

var minDistance = 20;

var coinIndex = 0;

var coins = hero.findItems();

var ogres = hero.findEnemies();

var ogre = hero.findNearest(ogres);

var closestCoin = hero.findNearest(coins);

```
while (coinIndex < coins.length) {
var target = coins[coinIndex];
coinIndex += 1;
var distance = hero.distanceTo(target);
if (distance < minDistance && target.value >= 2){
minDistance = distance;
closestCoin = target;
}
```

}

// If no ogre and a coin nearby, get it.

if (minDistance <= 20 && closestCoin !=ogre) {

hero.moveXY(closestCoin.pos.x, closestCoin.pos.y);

}

//If an ogre and a nearby coin, get the coin unless the ogre is close. If the ogre is close, teleport.

else if (minDistance <= 20 && closestCoin && ogre){

ogreDistance = hero.distanceTo(ogre);

```
if (ogreDistance >= 10 && closestCoin) {
hero.moveXY(closestCoin.pos.x, closestCoin.pos.y);
}
}
else if (closestCoin) {
if (hero.pos.x > 43 && hero.pos.y > 38){
hero.moveXY(75, 50);
}
if (hero.pos.x > 43 && hero.pos.y <= 38) {
hero.moveXY(75, 20);
}
if (hero.pos.x <= 43 && hero.pos.y > 38) {
hero.moveXY(5, 50);
}
if (hero.pos.x <= 43 && hero.pos.y <= 38) {
hero.moveXY(5, 20);
}
}
```

}