Problem with self.costOf


#1

I’m having some strange problem on Zero Sum level with self.costOf.
On the pre-last line it says:
“Check the cost of what?”

def summonTypes(): # ~2 soldiers, 4 griffins, 2 paladin
    if len(griffins) < 2:
        return "griffin-rider"
    elif len(paladins) < 2:
        return "paladin"
    elif len(soldiers) < 5:
        return "soldier"
    elif len(soldiers)/len(griffins) < 0.5:
        return "soldier"

    elif self.gold > 150:
        return "griffin-rider"

def summonUnits():
    sumType = summonTypes()
    if self.now() > 60 or len(enemies) > 1:
        d = self.distanceTo(self.findNearest(enemies))
        if d < 30 and sumType == "soldier":
            if self.gold > self.costOf(sumType):
                self.summon(sumType)
        if sumType != "soldier":
            if self.gold >= self.costOf(sumType):
                self.summon(sumType)

Might that be connected with hero jumping?
Because it happens from time to time.


#2

What does summonTypes return when you have 3 griffins, 3 paladins, 5 soldiers, more soldiers than griffins, and 149 gold?


#3

I think, I got your point!
Thanks, it helped.