[SOLVED] Mad maxer sell out probleme

hello guys, im stuck in this level but idk why :confused:

while(true) {
    var closestGold = null;
    var minGoldDist = 9001;
    var coinIndex = 0;
    var coins = hero.findItems();
    // Find the closest coin that is gold.
    // Remember that gold coins have a value of 3.
    while (coinIndex < coins.length) {
        var coin = coins[coinIndex];
        if (coin) {
            var dist = hero.distanceTo(coin);
            if (dist < minGoldDist && coin.value === 3) {
                var closestGold = coin;
                var minGoldDist = dist;
        coinIndex += 1;
    if(closestGold) {
        // Now go to the closest gold coin and get it!
        hero.moveXY(closestGold.pos.x, closestGold.pos.y);

Your closing brackets are not lined up quite right:

Delete that bottom bracket and move it to the very end of your code, instead.

1 Like

ok, i remove it and i add other one after the last if statement and its work, thanks for ur help dedreous

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