Goalkeeper confusion


#1

For some reason, my peasants are walking towards me instead of the ball. This is my code:

# Command the peasants to prevent the ogres from scoring.
# The fireball is type "ball".
loop:
    friends = self.findFriends()
    ball=self.findByType("ball")
    for peasant in friends:
        self.command(peasant, "move", {"x":15,"y":ball.y})


#2

findByType always returns a list. You want the first (and only) item in that list, which is at index 0:

    ball = self.findByType("ball")[0]

#3

I think i got lucky
i just pressed submit and the ogres failed to make 1 goal