Mixed Unit Tactics-Python


#1

Hi can some help, thanks

def summonTypes():
    type=summonTypes[len(self.built) % len(summonTypes)]
def summonTroops():    
    if self.gold >= self.costOf('soldier'):
        self.summon('soldier')
def commandTroops():
    friends=self.findFriends()
    for friend in friends:
        enemies=self.findEnemies()
        enemy=self.findNearestEnemy()
        self.command(friend, "attack", enemies)
def collectCoins():
    coin=self.findNearest(self.findItems())
    self.move(coin.pos)
loop:
    summonTypes()
    summonTroops()
    commandTroops()
    collectCoins()


#2

Here’s the default code:

# Practice using modulo to loop over an array

# Choose the mix and order of units you want to summon by populating this array:
summonTypes = []

def summonTroops():
    # Use % to wrap around the summonTypes array based on len(self.built)
    #type = summonTypes[???]
    hero.say("I should summon troops!")

Keep and read the comments.