The-hunt-begins


#1

function averageSize(burls) {
var sum = sumSize(burls);
return sum / burls.length;
}

function sumSize(burls) {
var sum = 0;
var enemies = hero.findEnemies();
for (var i = 0; i < enemies.length; i++) {
var enemy = enemies[i];
sum = sum + enemy.size;
}
return sum;
}

while(true) {
var burls = hero.findEnemies();
averageSize(burls);
hero.say("The average size of the seen burls " + averageSize(burls));
}

Do anyone knows how this code can be improved to make it works?