[SOLVED] Reaping Fire (python)

My hero survives with 2995 health.

1 Like

But I didn’t use the invisibility ring.

1 Like

It took me about a week of tweaking my code before I could survive long enough to get the 60 second bonus. I kept changing heroes and tactics and slowly lasting longer and longer until I finally got it on the bazillionth try.

1 Like

@MunkeyShynes, I still need to protect the minefield.

1 Like

Not necessarily. It blows up when I run my code too. It just has to survive for 30 seconds to pass the level. I noticed when I ran your code that you’re not continuously collecting coins. It’s seems to stop for a while and then begin again. This isn’t good because it limits the number of griffin riders you can summon. You need as many as possible to keep the ogres and munchkins away from the minefield for as long as possible.

Edit: It appears that once Tharin commands the griffin-riders to attack, he no longer goes back to collecting coins. Also, once the first fang-rider is killed, he keeps attacking even after its dead.

1 Like

It appears that once the code begins a function, it gets stuck in that function. If you summon a griffin-rider, he stands in one place swinging his sword, presumably summoning that one griffin-rider over and over again. Once you attack, the code is stuck in the attack function until another condition is introduced that causes the code to move on to another function.

1 Like

I managed to pass the level using your code and equipment by simply changing the move method to moveXY in the pickUpCoin() function. However, if you’re going to go after the 60 second bonus, it’s going to take a lot of reconstruction. This level works a ton better when you use arrays.

1 Like

I tweaked a little bit your code and beat the level with the bonus with no so good armor.

def chooseStrategy():
        # .... your code here
        # if enemy.type is "fangrider" and hero.distanceTo(enemy) < 30:
        # fangriders must be on the left to the mines
        if enemy.type is "fangrider" and enemy.pos.x < 38:
        # my function doesn't return  "collect-coins" commented  the rows
        # else:
        #     return "collect-coins"

def heroAttack():
    # Your code here
    # same logic as above 
    # if enemy and hero.distanceTo(enemy) < 30:
    if enemy and enemy.type == 'fangrider' and enemy.pos.x < 38:    
        hero.attack(enemy)
loop:
    # Your code here
    elif strategy == "fight-back":
        heroAttack()
    # Collect coins unconditionally  after summoning and killing intruders
    # elif strategy == "collect-coins":
    pickUpCoin()

You can improve pickUpCoin() , summon a peasant to help you collecting coins, replace

for griffin in hero.findByType("griffin-rider"):
# with
griffins =  hero.findByType("griffin-rider")
for griffin  in griffins:

for not making a call to a method on every iteration

2 Likes

Wow. Didn’t know that, thanks. But have no idea, why is it so.

1 Like

btw guys, you know that you can go through the landmine, right? (you can literally walk through it)

I killed enemies myself before 35 seconds, then shielded for the rest of the time. Easy :smiley: (Need max armor tho)

Didn’t know that. Didn’t even try it. I spent a week on this level, changing heroes and strategies, tweaking it little by little until I got the 60 second bonus. But then, I like to follow directions to get the point of the lesson. I’ve even made some notes of things I want to go back and change when I get time to improve it.

1 Like

Well, if you are Ritic, then you can literally rig the landmines so the enemies can’t get to it (shadow vortex) then you can scattershot everything in the vortex. Easy!

Thanks for all the help! :smiley_cat:

1 Like

after some time I got it to work

1 Like

This is weird when I ran it, it said success but when I submitted it, it said incomplete?

1 Like

Just submit again until you get a seed that works.

Okay, thanks! :smiley:

1 Like

I do not know what happened but my hero is not commanding my griffinriders to attack!

1 Like

If you’d like assistance, post the code that you have so far and advise of any errors you are receiving. We need information in order to figure out what’s going on. Simply saying it’s not working isn’t enough.

this is my code:

// The goal is to survive for 30 seconds, and keep the mines intact for at least 30 seconds.
function chooseStrategy() {
var enemies = hero.findEnemies();
// If you can summon a griffin-rider, return “griffin-rider”
if (enemies.length > 0) {
return “griffin-rider”;
}
// If there is a fangrider on your side of the mines, return “fight-back”

if (enemies.length > 0) {
    return "fight-back";
}    // Otherwise, return "collect-coins"
else {
    return "collect-coin";
}

}
function commandAttack() {
// Command your griffin riders to attack ogres.
var enemy = hero.findNearest(hero.findEnemies());
var friend = hero.findNearest(hero.findFriends());
if (enemy) {
hero.command(friend, “attack”, enemy);
}
}
function pickUpCoin() {
// Collect coins
var items = hero.findItems();
for (var i = 0; i < items.length; i++) {
if (items && items.vlaue > 1) {
hero.moveXY(item.pos.x, item.pos.y);
}
}
}
function heroAttack() {
// Your hero should attack fang riders that cross the minefield.
var enemy = hero.findNearestEnemy();
if (enemy && enemy.type == “fangrider”) {
hero.attack(enemy);
}

}
while (true) {
var strategy = chooseStrategy();
// Call a function, depending on what the current strategy is.
if (strategy == “griffin-rider”) {
commandAttack();
}
if (strategy == “fight-back”) {
heroAttack();
}
if (strategy == “collect-coin”) {
pickUpCoin();
}
}