I have no idea what is wrong with my code because the only error I get is “Dont know how to transform: Set” and it will not give me more information
Here is my code:
# 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():
friend = hero.findFriends()
enemy = hero.findNearestEnemy()
soldiers = hero.findByType("soldier")
peasant = hero.findByType("peasant")
x = peasant.pos.x
y = peasant.pos.y
for soldier in soldiers:
hero.command(soldier, "defend", {x, y})
# Define the function: pickUpNearestCoin
def pickUpNearestCoin():
item = hero.findNearestItem()
if item:
hero.move(item.pos)
while True:
summonSoldiers()
commandSoldiers()
pickUpNearestCoin()