# \[SOLVED\] Zoo Keeper Stuck! Help

**URL:** <https://discourse.codecombat.com/t/solved-zoo-keeper-stuck-help/16043>\
**Category:** Solved\
**Created:** [September 26, 2018, 3:54pm UTC](https://discourse.codecombat.com/t/solved-zoo-keeper-stuck-help/16043 "2018-09-26T15:54:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sharknado](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/sharknado/32/9124_2.png) [@Sharknado](https://discourse.codecombat.com/u/Sharknado)\
**Post date:** [September 26, 2018, 3:54pm UTC](https://discourse.codecombat.com/t/solved-zoo-keeper-stuck-help/16043/1 "2018-09-26T15:54:21Z")

</div>

Can someone help me my hero collects the 80 coins but doesn’t make any soldiers to protect the cage?  
Here is my code.

```python
# Protect the cage.
# Put a soldier at each X.
points = []
points[0] = {"x": 33, "y": 42}
points[1] = {"x": 47, "y": 42}
points[2] = {"x": 33, "y": 26}
points[3] = {"x": 47, "y": 26}

# 1. Collect 80 gold.
while True:
    coin = hero.findNearest(hero.findItems())
    if hero.gold <=80:
        if coin:
            hero.move(coin.pos)

# 2. Build 4 soldiers.
for i in range(4):
    hero.summon("soldier")
# 3. Send your soldiers into position.
while True:
    friends = hero.findFriends()
    for j in range(len(friends)):
        point = points[j]
        friend = friends[j]
        enemy = friend.findNearestEnemy()
        if enemy and enemy.team == "ogres" and friend.distanceTo(enemy) < 5:
            # Command friend to attack.
            hero.command(friend, "attack", enemy)
            pass
        else:
            hero.command(friend, "move", point.pos)
            # Command friend to move to point.
            pass

```

---

<div class="post-metadata">

**Author:** ![123hi123](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/123hi123/32/9541_2.png) [@123hi123](https://discourse.codecombat.com/u/123hi123)\
**Post date:** [September 26, 2018, 4:56pm UTC](https://discourse.codecombat.com/t/solved-zoo-keeper-stuck-help/16043/2 "2018-09-26T16:56:08Z")

</div>

I think you need to add an else somewhere in

> [@Sharknado](#):
>
> ```python
> while True: coin = hero.findNearest(hero.findItems())
> if hero.gold <=80: 
> if coin: 
> hero.move(coin.pos)
> 
> ```

---

<div class="post-metadata">

**Author:** ![SuperSmacker](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/supersmacker/32/8385_2.png) [@SuperSmacker](https://discourse.codecombat.com/u/SuperSmacker)\
**Post date:** [September 27, 2018, 1:22am UTC](https://discourse.codecombat.com/t/solved-zoo-keeper-stuck-help/16043/3 "2018-09-27T01:22:17Z")

</div>

Yeah.

Under the else, put break

---

<div class="post-metadata">

**Author:** ![Sharknado](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/sharknado/32/9124_2.png) [@Sharknado](https://discourse.codecombat.com/u/Sharknado)\
**Post date:** [September 27, 2018, 1:52pm UTC](https://discourse.codecombat.com/t/solved-zoo-keeper-stuck-help/16043/4 "2018-09-27T13:52:36Z")

</div>

ok thx for advise 🌞

---

<div class="post-metadata">

**Author:** ![Oliver\_Munro](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/oliver_munro/32/12648_2.png) [@Oliver\_Munro](https://discourse.codecombat.com/u/Oliver_Munro)\
**Post date:** [June 8, 2020, 8:06am UTC](https://discourse.codecombat.com/t/solved-zoo-keeper-stuck-help/16043/5 "2020-06-08T08:06:09Z")

</div>

has anyone got past grid minefield?  
I can’t complete it.

---

<div class="post-metadata">

**Author:** ![jka2706](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/jka2706/32/13636_2.png) [@jka2706](https://discourse.codecombat.com/u/jka2706)\
**Post date:** [June 8, 2020, 9:01am UTC](https://discourse.codecombat.com/t/solved-zoo-keeper-stuck-help/16043/6 "2020-06-08T09:01:53Z")

</div>

Hi Oliver\_Munro,

Welcome to discourse! Yes we can help you with grid minefield 🙂. If you can post your code (there’s instructions on how to do this [here](https://discourse.codecombat.com/t/essentials-how-to-post-format-your-code-correctly/15521/2)), and a bit of information about what the problems is (are you getting an error, or is the hero getting killed etc) then folk will chip in to help.

Just one more comment - it might be better to start a new topic on this, as at the moment we’re posting on a different level discussion that’s 18 months old!

---

<div class="post-metadata">

**Author:** ![EpicCoder999](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/epiccoder999/32/12768_2.png) [@EpicCoder999](https://discourse.codecombat.com/u/EpicCoder999)\
**Post date:** [June 9, 2020, 4:02am UTC](https://discourse.codecombat.com/t/solved-zoo-keeper-stuck-help/16043/7 "2020-06-09T04:02:03Z")

</div>

Use moveXY if you’re dumb,  
use multiply and assign if you’re smart.

```python
from random import randint
    randint *= 1

```
