Help! Im stuck on zoo keeper


help im stuck on this level! this is my code

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}
while <=80:
coin = self.findNearest(self.findItems())
if coin:
for i in range(4):
friends = self.findFriends()
for j in range(len(friends)):
point = points[j]
friend = friends[j]
enemy = friend.findNearestEnemy()
if enemy and == “ogres” and friend.distanceTo(enemy) < 5:
self.command(friend, “attack”, enemy)
if friend:
self.command(friend, “move”, point)


does anyone know whats wrong with it?


my friends dont attack the ogres and im not sure what the problem is.


Maybe the if friend: cancels out the “attack” command above it, but it’s hard to be sure since the code isn’t formatted properly.

Please format your code properly by putting the proper back ticks or using the preformated text button. It’s explained in the FAQ that everyone should read "before posting."




Please format correctly by looking at the FAQ.


If you give two successive orders to a unit in the same loop cycle (or without letting time pass)
the second order will override the first:
command(attack) + command(move) = command(move)



thanks! It worked!!:grin: