[SOLVED] Zoo Keeper Stuck! Help

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

# 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:

# 2. Build 4 soldiers.
for i in range(4):
# 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)
            hero.command(friend, "move", point.pos)
            # Command friend to move to point.

I think you need to add an else somewhere in


Under the else, put break

ok thx for advise :sun_with_face:

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

Hi Oliver_Munro,

Welcome to discourse! Yes we can help you with grid minefield :slight_smile:. If you can post your code (there’s instructions on how to do this here), 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!

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

from random import randint
    randint *= 1