[SOLVED]Reaping fire, don't know what to do(python)

You don’t need this it won’t help

That’s still not causing the error.

# The goal is to survive for 30 seconds, and keep the mines intact for at least 30 seconds.
def chooseStrategy():
    # If you can summon a griffin-rider, return "griffin-rider"
    if hero.gold > hero.costOf("griffin-rider"):
        return "griffin-rider"
    # If there is a fangrider on your side of the mines, return "fight-back"
    enemy = friend.findNearestEnemy()
    if enemy:
        fangrider = hero.findNearest(hero.findByType("fangrider")
        if fangrider and fangrider.pos.x < 25:
            return "fight-back"
            # Otherwise, return "collect-coins"
        else:
            return "collect-coins"
        
def commandAttack():
    # Command your griffin riders to attack ogres.
    enemy = hero.findNearestEnemy()
    friends = hero.findFriends()
    for friend in friends:
        hero.command(friend, "attack", enemy)
    pass
def pickUpCoin():
    # Collect coins
    item = hero.findNearestItem()
    if item:
        hero.move(item.pos)
    pass
def heroAttack():
    # Your hero should attack fang riders that cross the minefield.
    enemy = hero.findNearest(hero.findEnemies())
    distance = hero.distanceTo(enemy)
    if enemy and enemy.pos.x < 38 :
        hero.attack(enemy)
    pass
    
while True:
    commandAttack()
    strategy = chooseStrategy()
    # Call a function, depending on what the current strategy is.
    if strategy == "griffin-rider":
        hero.summon("griffin-rider")
    if strategy == "fight-back":
        heroAttack()
    if strategy == "collect-coins":
        pickUpCoin()

Missing a parentheses at the end of line 9.

2 Likes

Thank you! it took a ton of submits, but I finally got it.

2 Likes

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.