[Solved] Dust infinite loop

I’m doing dust when I submit when he retreats he freezes and it says that there is a infinite loop

# Use a while to loop until you have counted 10 attacks.

attacks = 0
while attacks < 10:
    # Attack the nearest enemy!
    enemy = hero.findNearestEnemy()
    hero.attack(enemy)
    # Incrementing means to increase by 1.
    # Increment the `attacks` variable.
    attacks += 1


# When you're done, retreat to the ambush point.
hero.say("I should retreat!") 
hero.moveXY(79, 33)

Have you checked if there is an enemy?

he still attacks the enemy’s

Check if there is an enemy, and please post your updated code.
Lydia

got it to work (20) charecters

Congrats!! :partying_face: :partying_face:
Lydia