# \[SOLVED\] Useful competitors issue

**URL:** https://discourse.codecombat.com/t/solved-useful-competitors-issue/20079
**Category:** Bugs
**Created:** [January 22, 2020, 7:29pm UTC](https://discourse.codecombat.com/t/solved-useful-competitors-issue/20079 "2020-01-22T19:29:13Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Mr.Wezi](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/mr.wezi/32/11324_2.png) [@Mr.Wezi](https://discourse.codecombat.com/u/Mr.Wezi)
#### Post date: [January 22, 2020, 7:29pm UTC](https://discourse.codecombat.com/t/solved-useful-competitors-issue/20079/1 "2020-01-22T19:29:13Z")

</div>

Hey guys, Im having trouble with the useful competitor level.I think it has a bug. Its not letting me retrieve the last coin.Also it has a gem in there which my player retrieves, but it leaves the last coin.My code is-

while True:  
enemy = hero.findNearestEnemy()  
if enemy:  
# Attack the enemy only if the type is NOT equal to “peon”.  
if enemy.type != “peon”:  
hero.attack(enemy)

```
item = hero.findNearestItem()

 # Gather the item only if the type is NOT equal to "poison".
if item and item.type != "poison":

        itemPos=item.pos
        itemX=item.pos.x
        itemY=item.pos.y
        hero.moveXY(itemX,itemY)
```

---

<div class="post-metadata">

### Author: ![Deadpool198](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/deadpool198/32/16753_2.png) [@Deadpool198](https://discourse.codecombat.com/u/Deadpool198)
#### Post date: [January 26, 2020, 6:58pm UTC](https://discourse.codecombat.com/t/solved-useful-competitors-issue/20079/2 "2020-01-26T18:58:44Z")

</div>

Hi @Mr.Wezi, welcome to the discourse.  
You’re code is correct, please could you post a screenshot of the level screen, you equipment.  
Thanks  
Danny

---

<div class="post-metadata">

### Author: ![Mr.Wezi](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/mr.wezi/32/11324_2.png) [@Mr.Wezi](https://discourse.codecombat.com/u/Mr.Wezi)
#### Post date: [January 28, 2020, 12:13am UTC](https://discourse.codecombat.com/t/solved-useful-competitors-issue/20079/3 "2020-01-28T00:13:51Z")

</div>

Hey Danny. Thanks a lot for your help. Fortunately the next day it worked,I guess there was a glitch at that time. But again thank you.
