//var enemies = hero.findEnemies();
var friends = hero.findFriends();
var yetis = hero.findByType(“yeti”, friends); //hero.say("yeti "+ yetis.length);
function averageSize(yetis) {
var sum = 0;
for (var i = 0; i < yetis.length; i++)
{
var ya = yetis[i];
sum = sum + ya.size;
}
return sum / yetis.length;
}
var a = averageSize(yetis);
hero.say(a);
P.S. Maybe it important, Yeties automaticaly dying at the beginning.
var yetis = hero.findByType(“yeti”);
function averageSize(yetis) {
var sum = 0;
// Go through each yak and add its size to the sum.
for (var i = 0; i < yetis.length; i++)
{
var ya = yetis[i];
sum = sum + ya.size;
}
return sum / yetis.length;
}
var a = averageSize(yetis);
hero.say(a);
And var yetis = hero.findByType(“yeti”, hero.findEnemies(); too
If i put hero.say("yeti "+ yetis.length);, it would be “Nan” of yeties.
Please refresh the page and try again, or improve your glasses. I believe the problem is that you are unable to see the Yetis. I implemented a fix, but fixing your glasses should help, too.