# Help With Shine Getter

**URL:** <https://discourse.codecombat.com/t/help-with-shine-getter/5500>\
**Category:** Uncategorized\
**Created:** [October 31, 2015, 9:44pm UTC](https://discourse.codecombat.com/t/help-with-shine-getter/5500 "2015-10-31T21:44:48Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![xXxMemeMan420xXx](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/xxxmememan420xxx/32/3195_2.png) [@xXxMemeMan420xXx](https://discourse.codecombat.com/u/xXxMemeMan420xXx)\
**Post date:** [October 31, 2015, 9:44pm UTC](https://discourse.codecombat.com/t/help-with-shine-getter/5500/1 "2015-10-31T21:44:48Z")

</div>

So I’ve been stuck on the level Shine Getter in the Desert World, and I need some help.  
So, I’m not sure what’s wrong with my code, but if anyone could help me out, I would appreciate it.  
My code:

```
> loop:
> coins = self.findItems()
> coinIndex = 0
> while coinIndex > len(coins):
> coin = coins[coinIndex]
> if coin.value == 3:
> self.moveXY(coin.pos.x, coin.pos.y)
> coinIndex += 1
```

---

<div class="post-metadata">

**Author:** ![ChronistGilver](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chronistgilver/32/3778_2.png) [@ChronistGilver](https://discourse.codecombat.com/u/ChronistGilver)\
**Post date:** [November 1, 2015, 12:36am UTC](https://discourse.codecombat.com/t/help-with-shine-getter/5500/2 "2015-11-01T00:36:37Z")

</div>

Your while-loop entails `while coinIndex > len(coins):`. The problem is, `coinIndex` is zero, and therefore is never greater then the amount of coins. I don’t suppose you meant `while coinIndex < len(coins):`?

---

<div class="post-metadata">

**Author:** ![xXxMemeMan420xXx](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/xxxmememan420xxx/32/3195_2.png) [@xXxMemeMan420xXx](https://discourse.codecombat.com/u/xXxMemeMan420xXx)\
**Post date:** [November 1, 2015, 12:49am UTC](https://discourse.codecombat.com/t/help-with-shine-getter/5500/3 "2015-11-01T00:49:16Z")

</div>

Then I just get a “Hard Execution Limit of 3 Million”

---

<div class="post-metadata">

**Author:** ![ChronistGilver](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chronistgilver/32/3778_2.png) [@ChronistGilver](https://discourse.codecombat.com/u/ChronistGilver)\
**Post date:** [November 1, 2015, 5:33am UTC](https://discourse.codecombat.com/t/help-with-shine-getter/5500/4 "2015-11-01T05:33:27Z")

</div>

Your indentations are also a little mixed up. If my assumptions are correct, you only increment `coinIndex` when you pick up a gold coin. This should not be. You want to loop over all coins.

---

<div class="post-metadata">

**Author:** ![xXxMemeMan420xXx](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/xxxmememan420xxx/32/3195_2.png) [@xXxMemeMan420xXx](https://discourse.codecombat.com/u/xXxMemeMan420xXx)\
**Post date:** [November 1, 2015, 5:52pm UTC](https://discourse.codecombat.com/t/help-with-shine-getter/5500/5 "2015-11-01T17:52:27Z")

</div>

Just tried it when you _find_ a gold coin, not when you walk over it, and it worked. Thanks for your help

---

<div class="post-metadata">

**Author:** ![xXxMemeMan420xXx](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/xxxmememan420xxx/32/3195_2.png) [@xXxMemeMan420xXx](https://discourse.codecombat.com/u/xXxMemeMan420xXx)\
**Post date:** [November 1, 2015, 5:53pm UTC](https://discourse.codecombat.com/t/help-with-shine-getter/5500/6 "2015-11-01T17:53:33Z")

</div>

Lol I just got the 100 levels achievement and got 1,000 gems, too. 😀

---

<div class="post-metadata">

**Author:** ![Godbuster](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/godbuster/32/8594_2.png) [@Godbuster](https://discourse.codecombat.com/u/Godbuster)\
**Post date:** [July 22, 2018, 7:00am UTC](https://discourse.codecombat.com/t/help-with-shine-getter/5500/7 "2018-07-22T07:00:18Z")

</div>

Excuse me, what is wrong with my code?

# To grab the most gond quickly, just go after gold coins.

while True:  
coins = hero.findItems()  
coinIndex = 0

```
# Wrap this into a loop that iterates over all coins.
while coinIndex < len(coins):
    coin = coins[coinIndex]
    hero.moveXY(coin.pos.x, coin.pos.y)
# Gold coins are worth 3.
if coin.value == 3:
    # Only pick up gold coins.
    hero.moveXY(coin.pos.x, coin.pos.y)
    pass
```

---

<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:** [July 22, 2018, 1:17pm UTC](https://discourse.codecombat.com/t/help-with-shine-getter/5500/8 "2018-07-22T13:17:26Z")

</div>

First, your if conditional statement should be inside your while loop. It appears that it is inside the `while True:` loop, but not inside the `while coinIndex < len(coins):` loop where it should be.

Second, you are not incrementing. You must increment `coinIndex`.
