# If the peasant is damaged, the flowers will shrink!
def summonSoldiers():
if hero.gold >= hero.costOf("soldier"):
hero.summon("soldier")
# Define the function: commandSoldiers
def commandSoldiers():
enemy = hero.findNearestEnemy()
hero.command(friend, "attack", enemy)
# Define the function: pickUpNearestCoin
def pickUpNearestCoin():
coin = hero.findNearestItem()
hero.move(coin.pos)
peasant = hero.findByType("peasant")[0]
while True:
summonSoldiers()
commandSoldiers()
pickUpNearestCoin()