The Two Flowers - Python


#1
# 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 ():
    hero.command(Soldiers, "attack", target)
# Define the function: pickUpNearestCoin
def pickUpNearestCoin ():
    peasant = hero.findByType("peasant")[0]

while True:
    summonSoldiers()
    # commandSoldiers()
    # pickUpNearestCoin()
    hero.findNearesItem()
    


#2

???


#3

never mind
just a typo


#4

But I still need help.


#5

Well, there’s a lot missing. Your commandSoldiers function needs to have a lot more code defining enemy and soldiers and use a loop. Your pickUpNearestCoin function contains zero code regarding finding and moving to a coin’s position to pick it up. Your while True loop doesn’t contain enough code either. You need to call all 3 of your functions there.


#6

Thanks!:smiley:
(20 chars)