Help with Sarven Rescue - Python. Maybe a bug

I keep on having success when i run the code. But when I submit it, it runs out of time. I don’t know what is wrong with it. Is this a bug or is this a error with my code? My code is below:

enemy = hero.findNearest(hero.findEnemies())
while hero.distanceTo(hero.findNearest(hero.findEnemies())) > 10:
    enemy = hero.findNearest(hero.findEnemies())
    hero.cleave(hero.findNearest(hero.findEnemies()))
hero.moveXY(115, 12)
enemy = hero.findNearest(hero.findEnemies())
while enemy :
    enemy = hero.findNearest(hero.findEnemies())
    if hero.isReady("cleave") :
        hero.cleave(enemy)
        ready = hero.isReady("bash")
    else :
        hero.attack(enemy)
hero.moveXY(12, 12)

This is a subscriber level. I am using Hattori. And my gear is the following:


Please help me.

Send a link please.


https://codecombat.com/play/level/sarven-rescue?
Here you go.

Ah, sorry, can’t help you with this one. I brute-forced it with good gear and flags (yep, yep)

Even when I do that, I still run out of time.

New code:

while hero.distanceTo(hero.findNearest(hero.findEnemies())) > 10:
    enemy = hero.findNearest(hero.findEnemies())
    hero.cleave(hero.findNearest(hero.findEnemies()))
hero.moveXY(115, 12)
enemy = hero.findNearest(hero.findEnemies())
while enemy:
    enemy = hero.findNearest(hero.findEnemies())
    if hero.isReady("cleave") :
        hero.cleave(enemy)
        ready = hero.isReady("bash")
    else:
        hero.attack(enemy)
hero.moveXY(12, 12)

Ah, nope. Sorry. Turns out I also

I’ll try the level again without flags if you want though.

I am just gonna submit until i pass it now.

Ok, sorry.

Silent Truthseer