Marauder. Please Help


#1
while (true) {
    var coin = hero.findNearest(hero.findItems());
        while(coin) {
            hero.moveXY(coin.pos.x, coin.pos.y);
        }
         coin = hero.findNearest(hero.findItems());
        
    var enemy = hero.findNearestEnemy();
    if (enemy) {
        while(enemy.health > 0) {
            hero.attack(enemy);
        }
    }
}

Hey guys why is this code doesn’t work?


#2

How do you exit from the while(coin) loop. You never update this unique coin and the loop is perpetual. One brace is misplaced… See Marauder: complicated way is only slightly better - it’s python, but the language doesn’t matter.