[Timber Guard] Soldiers Too slow

Hi everyone,
I’m looking for some help on level Timber Guard.
My soldiers are not moving fast enough to defeat the first wave of enemies to protect the peasants.
I have changed my code for my hero to collect the most valuable coins to generate soldiers faster, but still not working.

def findBestCoin():
    worth = 0
    bestCoin = None
    coins = hero.findItems()
    for coin in coins:
        if coin.value / hero.distanceTo(coin) > worth:
            worth = coin.value / hero.distanceTo(coin)
            bestCoin = coin
    return bestCoin

while True:
    bestCoin = findBestCoin()
    if bestCoin:
        hero.moveXY(bestCoin.pos.x, bestCoin.pos.y)
    # If you have enough gold, summon a soldier.
    if hero.gold > hero.costOf("soldier"):
    # Use a for-loop to command each soldier.
    # For loops have two parts: "for X in Y"
    # Y is the array to loop over.
    # The loop will run once for each item in Y, with X set to the current item.
    for friend in hero.findFriends():
        if friend.type == "soldier":
            enemy = friend.findNearestEnemy()
            if (enemy):
                hero.command(friend, "attack", enemy)
                hero.command(friend, "move", {'x': 69, 'y': 42})