I recently tried to rebeat Peasant Protection, and even after following the instructions I had trouble.
Here is my code:
while True: enemy = hero.findNearestEnemy() distance = hero.distanceTo(enemy) if distance < 10: # Attack if they get too close to the peasant. self.attack(enemy) # Else, stay close to the peasant! Use else. else: self.moveXY(40, 37)
as you can see, I did what the instructions said, but no matter what i did my code didn’t seem to work. the hints didn’t help either.