# Help with Sarven Rescue - Python. Maybe a bug

**URL:** <https://discourse.codecombat.com/t/help-with-sarven-rescue-python-maybe-a-bug/33865>\
**Category:** Level Help\
**Created:** [September 19, 2022, 12:41pm UTC](https://discourse.codecombat.com/t/help-with-sarven-rescue-python-maybe-a-bug/33865 "2022-09-19T12:41:29Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZAX155](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/zax155/32/34141_2.png) [@ZAX155](https://discourse.codecombat.com/u/ZAX155)\
**Post date:** [September 19, 2022, 12:41pm UTC](https://discourse.codecombat.com/t/help-with-sarven-rescue-python-maybe-a-bug/33865/1 "2022-09-19T12:41:29Z")

</div>

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:

```python
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:

 ![image](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/3X/0/b/0be49ccee578f58da3d978cfeceb2ede88657428.jpeg)  
Please help me.

---

<div class="post-metadata">

**Author:** ![Anonym](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/anonym/32/47546_2.png) [@Anonym](https://discourse.codecombat.com/u/Anonym)\
**Post date:** [September 19, 2022, 12:43pm UTC](https://discourse.codecombat.com/t/help-with-sarven-rescue-python-maybe-a-bug/33865/2 "2022-09-19T12:43:18Z")

</div>

Send a link please.

* * *

---

<div class="post-metadata">

**Author:** ![ZAX155](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/zax155/32/34141_2.png) [@ZAX155](https://discourse.codecombat.com/u/ZAX155)\
**Post date:** [September 19, 2022, 12:43pm UTC](https://discourse.codecombat.com/t/help-with-sarven-rescue-python-maybe-a-bug/33865/3 "2022-09-19T12:43:57Z")

</div>

[https://codecombat.com/play/level/sarven-rescue?](https://codecombat.com/play/level/sarven-rescue?)  
Here you go.

---

<div class="post-metadata">

**Author:** ![Anonym](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/anonym/32/47546_2.png) [@Anonym](https://discourse.codecombat.com/u/Anonym)\
**Post date:** [September 19, 2022, 12:48pm UTC](https://discourse.codecombat.com/t/help-with-sarven-rescue-python-maybe-a-bug/33865/5 "2022-09-19T12:48:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ZAX155](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/zax155/32/34141_2.png) [@ZAX155](https://discourse.codecombat.com/u/ZAX155)\
**Post date:** [September 19, 2022, 12:50pm UTC](https://discourse.codecombat.com/t/help-with-sarven-rescue-python-maybe-a-bug/33865/6 "2022-09-19T12:50:18Z")

</div>

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

New code:

```python
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)

```

---

<div class="post-metadata">

**Author:** ![MarmiteOnToast](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/marmiteontoast/32/46649_2.png) [@MarmiteOnToast](https://discourse.codecombat.com/u/MarmiteOnToast)\
**Post date:** [September 19, 2022, 12:51pm UTC](https://discourse.codecombat.com/t/help-with-sarven-rescue-python-maybe-a-bug/33865/7 "2022-09-19T12:51:42Z")

</div>

Ah, nope. Sorry. Turns out I also

> [@Anonym](#):
>
> brute-forced it with good gear and flags

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

---

<div class="post-metadata">

**Author:** ![ZAX155](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/zax155/32/34141_2.png) [@ZAX155](https://discourse.codecombat.com/u/ZAX155)\
**Post date:** [September 19, 2022, 12:53pm UTC](https://discourse.codecombat.com/t/help-with-sarven-rescue-python-maybe-a-bug/33865/8 "2022-09-19T12:53:19Z")

</div>

I am just gonna submit until i pass it now.

---

<div class="post-metadata">

**Author:** ![MarmiteOnToast](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/marmiteontoast/32/46649_2.png) [@MarmiteOnToast](https://discourse.codecombat.com/u/MarmiteOnToast)\
**Post date:** [September 19, 2022, 12:53pm UTC](https://discourse.codecombat.com/t/help-with-sarven-rescue-python-maybe-a-bug/33865/9 "2022-09-19T12:53:40Z")

</div>

Ok, sorry.

Silent Truthseer
