Python: Reaping Fire idea help


How can I make a block of code where if the Fangrider’s x position is less than the right edge of the minefield, the griffin riders disengage from it and attack other ogres while my hero stops collecting coins and goes to attack the Fangrider. My code is posted down below.

# The goal is to survive for 30 seconds, and keep the mines intact for at least 30 seconds.

def chooseStrategy():
    enemies = hero.findEnemies()
    # If you can summon a griffin-rider, return "griffin-rider"
    if >= hero.costOf("griffin-rider"):
        return "griffin-rider"
    # If there is a fangrider on your side of the mines, return "fight-back"
    fangriders = hero.findByType("fang-rider")
    if fangriders:
        for i in range(len(fangriders)):
            fangrider = fangriders[i]
            if fangrider.pos.x < 38:
                return "fight-back"
    # Otherwise, return "collect-coins"
        return "collect-coins"

def commandAttack():
    # Command your griffin riders to attack ogres.
    griffinriders = hero.findByType("griffin-rider")
    for i in range(len(griffinriders)):
        griffinrider = griffinriders[i]
        enemy = hero.findNearestEnemy()
        if enemy and enemy.type != "fang-rider":
            hero.command(griffinrider, "attack", enemy)
def pickUpCoin():
    # Collect coins
    item = hero.findNearestItem()
    hero.moveXY(item.pos.x, item.pos.y)
def heroAttack():
    # Your hero should attack fang riders that cross the minefield.
    fangriders = hero.findByType("fang-rider")
    for i in range(len(fangriders)):
        if fangriders[i].pos.x < 38:
while True:
    strategy = chooseStrategy()
    # Call a function, depending on what the current strategy is.
    if "griffin-rider":
    if "fang-rider":
    if "collect-coins":


Fangrider’s type is Fangrider not fang-rider. That’s your problem.

Also, in the while loop where you choose strategy, you need to say if strategy == “strategy name” not just “strategy name”