Am I not allowed to use unit types in pesky yak?

The types of the enemies in the level pesky yak are scrambled up

In the picture, I was expecting the type to be ogre. With the scrambled name I cannot think of an easy way to get rid of high dps units first.

Is this intentional? If so, why disallow such strategies?

I, personally, don’t know whether this is intentional, but the intention of the level is to make you write a function that removes certain types of the enemies. What is your code?

You get the same scrambled type with the code

loop{
    enemies = this.findEnemies();
    enemy = this.findNearest(enemies);
    if(enemy){
        this.say(enemy.type);
    }
}

The level is just a bit hard, so I kind of needed this trick to finish it consistently. I did finish it, but then when I submitted it I had less luck. I have 1733 hp and boots of speed, but a bad weapon. My character is Anya.

Well, why do you need to say it at all?

He doesn’t need to say it, he is saying it to debug why it doesn’t match enemy.type == “ogre”

Yes, type is probably the best way to go, but if your sense stone allows it you could do maxHealth (click on the ogres on screen and point at their health bar to see the values yourself, or say them of course)

[details= :smile:]
Programatically, you could make an end run around obfuscated mob-types, find the ones with health X and store the type in a variable then use that variable in your code.[/details]

Please don’t go there

I think I understand why I they would want to discourage me to use the types of enemies. This must be because they do not want you to build up the array of “real enemies” by using findByType on the different types of enemies. Removing the yaks makes the code more stabile and reusable, as you do not have to know in advance what kind of enemies there will be.

I would think that a message in the guide or a comment in the code about this would be helpful.

Yngvi, I was actually thinking about that. It beats writing a isAnagramOf function. But I also agree with Feinty that this is may not be the best exercise.