Hi, I need help on Mixed Units tactics in python. Here is my 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 = ["soldier", "soldier", "soldier", "soldier", "archer", "archer", "archer", "archer"]
def summonTroops():
# Use % to wrap around the summonTypes array based on len(self.built)
#type = summonTypes[???]
type = summonTypes[len(self.built) % len(summonTypes)]
def collectCoins():
coin = hero.findNearest(hero.findEnemies())
if coin:
hero.move(coin.pos)
def commandTroops():
friend = hero.findNearest(hero.findFriends())
enemy = hero.findNearest(hero.findEnemies())
if enemy and friend.type is not "palisade":
if friend:
hero.command(friend, "attack", enemy)
while True:
summonTroops()
collectCoins()
commandTroops()