Reaping fire python, please help

Here is my code:

# The goal is to survive for 30 seconds, and keep the mines intact for at least 30 seconds.
enemyIndex = 0
def chooseStrategy():
    enemyyyy = hero.findNearestEnemy()
    enemies = hero.findEnemies()
    # If you can summon a griffin-rider, return "griffin-rider"
        return "griffin-rider"
    # If there is a fangrider on your side of the mines, return "fight-back"
    while enemyIndex<len(enemies):
        enemy = enemies[enemyIndex]
        if enemy.type == 'fangrider' and hero.distanceTo(enemyyyy):
            return heroAttack()
    # Otherwise, return "collect-coins"
    return pickUpCoin()

def commandAttack():
    # Command your griffin riders to attack ogres.
    enemy = hero.findNearestEnemy()
    if enemy:
        soldier = hero.findFriends()
        soldierIndex = 0
        while soldierIndex  < len(soldier):
            soldier = soldiers[soldierIndex]
            hero.command(soldier, "attack", enemy)
def pickUpCoin():
    # Collect coins
    item = hero.findNearestItem()
    if item:
def heroAttack():
    # Your hero should attack fang riders that cross the minefield.
    enemy = hero.findNearestEnemy()
    if enemy:
while True:
    strategy = chooseStrategy()
    # Call a function, depending on what the current strategy is.

This should be

return "fight-back"

Also, what if you can’t return “griffin-rider” or return “fight-back”. Use an else statement with

return "collect-coins"

Then in your while true loop, create a variable for chooseStrategy() and check if the variable is equal to a strategy.

what world is this on

It is a level in Cloudrip Mountain.

oh okay sorry i cannot help then

I’d like to note that when I used the strategy they told me to, I failed, so I just collected coins, while griffin riders fought.

What’s this for?
are you supposed to use 4 y’s?

I noticed it right away. I’m only at the beginning of the mountains, so don’t ask me for more help. :smiley:

I already had a variable for enemy so enemyyy is a different veriable

Ok, so that’s just your personal variable. cool. :slightly_smiling_face:

yep thats correct @CocoCharlie

use else

i tough you where using griffin-riders therefore soldiers will just blow the minefield up

use hero.distanceTo(enemyyyy) < (the distance you want)

The soldiers is actually a variable for griffin riders, sorry for the confusion XD

1 Like