friends = hero.findFriends()
for friend in friends:
# 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", "archer"]
def summonTroops():
# Use % to wrap around the summonTypes array based on len(hero.built)
#type = summonTypes[???]
soldier = summonTypes["soldier"]
archer = summonTypes["archer"]
len(hero.built) % len(summonTypes)
def collectCoins():
coin = hero.findNearestItem()
if coin:
hero.move(coin.pos)
def commandTroops():
enemy = hero.findNearestEnemy()
if enemy:
hero.summon(soldier, "attack", enemy)
hero.summon(soldier, "attack", enemy)
else:
hero.summon(soldier, "defend", hero.pos)
hero.summon(archer, "defend", hero.pos)
while True:
summonTroops()
collectCoins()
commandTroops()
here is the error i am getting