[SOLVED] Timber Guard help please

Then congratulations for completing the level! :partying_face:

My code won’t work… I can’t get the soldiers to attack the ogres.
My code:

gold = hero.findNearestItem()
if gold:
    hero.moveXY(gold.pos.x, gold.pos.y)
# If you have enough gold, summon a soldier.
if hero.gold > hero.costOf("soldier"):
    hero.summon("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()
        defendPos = {"x": 91, "y":40}
        # If there's an enemy, command her to attack.
        # Otherwise, move her to the right side of the map.
        if enemy:
            hero.command(friend, "attack", enemy)
        else:
            hero.command(friend, "move", defendPos)

never mind. I fixed it.