Level "Mixed Unit Tactics" Problems


It seems that I can only summon about 3 units before 20 enemy units are summoned in 25 seconds.

I’m not sure if this is fair or there is something I’m missing.

Also the palisade is counted as an enemy, not sure if intended.


Hello Justin,

Help us help you, what is your code? If we know your code, we can inspect it for errors that might cause your problem.


I’ve been trying different things but this is the last thing I had

coin = self.findNearest(self.findItems())

summonTypes = ["soldier","soldier","archer"]
type = summonTypes[len(self.built) % len(summonTypes)]
if self.gold >= self.costOf(type):

friends = self.findFriends()
for friend in friends:
    enemies = self.findEnemies()
    enemyIndex = 0 
    while enemyIndex < len(enemies):
        enemy = enemies[enemyIndex]
        if enemy.type != "palisade":
            if enemy.type == "thrower":
                self.command(friend, "attack", enemy)
            elif enemy and friend.distanceTo(enemy) < 40: 
                self.command(friend, "attack", enemy)
        enemyIndex += 1


Ah. First things first,

#Indentation is everything!

In Python, whitespace is mandatory to the running of a program. None of your commands are inside the loop. put them is, then see that happens.


woops, thats just when I copied and pasted it. I have it indented properly


Please read the FAQ and learn how to post your code so that is appears in the forum properly.
Then fix the code in your post, so that it is indented properly.

The palisade being an enemy forces you to control your soldiers, instead of just letting them run wild attacking whatever they see…


I got it, thanks.

The palisade was changed to being one of your troops instead.


Yeah. :frowning: I liked it better the other way, but being a friend makes it easier to tell when you have killed all the orges (if whole team is dead, you’re done, instead of if certain team members are dead…)


I wish pailsides were neutral