# Question about Marauder in Sarven Desert

**URL:** <https://discourse.codecombat.com/t/question-about-marauder-in-sarven-desert/9452>\
**Category:** Uncategorized\
**Created:** [October 25, 2016, 8:23pm UTC](https://discourse.codecombat.com/t/question-about-marauder-in-sarven-desert/9452 "2016-10-25T20:23:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![MunkeyShynes](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/munkeyshynes/32/9277_2.png) [@MunkeyShynes](https://discourse.codecombat.com/u/MunkeyShynes)\
**Post date:** [October 25, 2016, 8:23pm UTC](https://discourse.codecombat.com/t/question-about-marauder-in-sarven-desert/9452/1 "2016-10-25T20:23:06Z")

</div>

I’ve completed this level - kind of. It works and says successful, however I don’t understand what the line,

```python
# Reassign the coin variable to the nearest item

```

is supposed to do. This is blank in my code and it runs fine.

```python
`while True:
    coin = hero.findNearest(hero.findItems())
    # While a coin exists:
    if coin:
        # Move to the coin.
        hero.moveXY(coin.pos.x, coin.pos.y)
        # Reassign the coin variable to the nearest item.
        (Yellow arrow pointing at this line)
    `

```

There is still a yellow arrow pointing at this line indicating that I need to write something there but it seems to run fine without it.

Please explain how that is supposed to work. Obviously I’m missing something.

Thank you.

---

<div class="post-metadata">

**Author:** ![Xector64](https://avatars.discourse-cdn.com/v4/letter/x/45deac/32.png) [@Xector64](https://discourse.codecombat.com/u/Xector64)\
**Post date:** [October 25, 2016, 8:34pm UTC](https://discourse.codecombat.com/t/question-about-marauder-in-sarven-desert/9452/2 "2016-10-25T20:34:39Z")

</div>

@MunkeyShynes I’ve come across that quite often. I’ve realized it is just trying to say that the code should be written there referring to what explanation it is giving. You can write the entire code somewhere else and so long as the code is correct and works in the way it is supposed to you will still pass the level but the arrow may remain there thinking that you haven’t done that step yet. I usually just get rid of said line if I come across this issue, but perhaps someone more experienced knows a better answer than I. Still hope it helps. 🙂

---

<div class="post-metadata">

**Author:** ![Harry\_the\_Wanderer](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/harry_the_wanderer/32/5369_2.png) [@Harry\_the\_Wanderer](https://discourse.codecombat.com/u/Harry_the_Wanderer)\
**Post date:** [October 29, 2016, 11:31pm UTC](https://discourse.codecombat.com/t/question-about-marauder-in-sarven-desert/9452/3 "2016-10-29T23:31:15Z")

</div>

@MunkeyShynes as @Xector64 was saying it won’t affect your code.

The game is setup in a way that it asks you to place code pieces in certain locations. In your case you have the code it was asking for before the if statement. If your way works as well, then you are fine. There are more then one solution to each problem. But the system isn’t necessarily able to check all of these combinations yet to know that you are ok.

There are cues in the source to tell the game to place a yellow arrow after such a comment to help the students that may not know what to do next.

Does that make sense?

-HW

---

<div class="post-metadata">

**Author:** ![Mr\_NotSoPerfect](https://avatars.discourse-cdn.com/v4/letter/m/e9a140/32.png) [@Mr\_NotSoPerfect](https://discourse.codecombat.com/u/Mr_NotSoPerfect)\
**Post date:** [January 9, 2017, 3:10pm UTC](https://discourse.codecombat.com/t/question-about-marauder-in-sarven-desert/9452/4 "2017-01-09T15:10:54Z")

</div>

My code seemed long, but it worked:

`[removed correct solution]`

---

<div class="post-metadata">

**Author:** ![17\_swords](https://avatars.discourse-cdn.com/v4/letter/1/e79b87/32.png) [@17\_swords](https://discourse.codecombat.com/u/17_swords)\
**Post date:** [March 24, 2017, 3:47pm UTC](https://discourse.codecombat.com/t/question-about-marauder-in-sarven-desert/9452/5 "2017-03-24T15:47:58Z")

</div>

My code has a strange problem. My code should run correctly, but for some reason, I only collect the first two coins and then stop. My code doesn’t have any errors that I can see.

# Destroy mechs and collect gold from them.

coinIndex = 0  
while True:  
coin = hero.findNearestItem()  
# While a coin exists:  
while coin:  
# Move to the coin.  
hero.moveXY(coin.pos.x, coin.pos.y)  
# Reassign the coin variable to the nearest item.  
coinIndex += 1  
enemy = hero.findNearestEnemy()  
if enemy:  
# While enemy’s health is greater than 0.  
while enemy.health \> 0:  
# Attack enemy.  
hero.attack(enemy)  
pass

---

<div class="post-metadata">

**Author:** ![Luke10](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/luke10/32/19892_2.png) [@Luke10](https://discourse.codecombat.com/u/Luke10)\
**Post date:** [March 24, 2017, 3:48pm UTC](https://discourse.codecombat.com/t/question-about-marauder-in-sarven-desert/9452/6 "2017-03-24T15:48:40Z")

</div>

Please format your code according to the FAQ.  
[https://discourse.codecombat.com/faq](https://discourse.codecombat.com/faq)

---

<div class="post-metadata">

**Author:** ![Luke10](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/luke10/32/19892_2.png) [@Luke10](https://discourse.codecombat.com/u/Luke10)\
**Post date:** [March 24, 2017, 3:51pm UTC](https://discourse.codecombat.com/t/question-about-marauder-in-sarven-desert/9452/7 "2017-03-24T15:51:26Z")

</div>

> [@17\_swords](#):
>
> coin = hero.findNearestItem()

I’m not sure if that’s a real command at all

---

<div class="post-metadata">

**Author:** ![17\_swords](https://avatars.discourse-cdn.com/v4/letter/1/e79b87/32.png) [@17\_swords](https://discourse.codecombat.com/u/17_swords)\
**Post date:** [March 24, 2017, 3:52pm UTC](https://discourse.codecombat.com/t/question-about-marauder-in-sarven-desert/9452/8 "2017-03-24T15:52:10Z")

</div>

Thanks. I found the problem. I said while instead of if.
