About mountain mercenaries, Is my speed too slow?


This is my code.The process was smooth but I still can not pass the level.I spent all time so is it because of my speed?My hero is THARIN.
Thanks for every reply.


    while self.gold > self.costOf("soldier"):
        enemy = self.findNearest(self.findEnemies())
        if enemy:
            soldiers = self.findFriends()
            soldierIndex = 0
            while soldierIndex<len(soldiers):
            soldier = soldiers[soldierIndex]
            self.command(soldier, "attack", enemy)


as a Hint, but that shouldnt be your Problem:
instead of using while for your friends use:

for fried in friends:

you may also use the nearest enemy of that soldier, not the nearest to u…

i actually do not see a problem with your code, but it worked with Tarin for me.

You also can use:

if self.gold >= self.costOf():

but its not important.

As solution try:

if there is no enemy:
  command soldiers to move to east. 

What exact is your problem? Du ur soldiers do not kill the attackers? If that, try to submit again. Maybe the new seed will help


Thank you for the suggestions.
My soldiers can not kill the last enemies.There are about 3 monsters.That is why I guess the speed is the problem.
By the way,I will keep trying.


Thank bmmtstb:
I already pass the level.But I do not know the reason.
I submitted the code again then I passed the level.
But if I try running the code(the left button), they spent all time.
What is the different about the left and right button?


with the submit button (right) you will always get a new random seed for your level. With the left u will always replay the last seed you have been given in your last submition.
Thats the reason why in repeatable levels you can fail in submission, because the seed is another…


I got it.I understand the difference after your explanation.Thank you very much.You help me to keep forward in the game.:slight_smile: