Forest miners please help


#1

Check if the mines are safe for the workers.

def checkEnemyOrSafe(target):
# If target (the parameter) exists:
if target:
# Then attack target.
hero.attack(target)
# Otherwise use say() to call the peasants.
else:
hero.say(“Clear”)
pass

while True:
    # Move to, and check the top right X mark.
    hero.moveXY(64, 54)
    enemy = hero.findNearestEnemy()
    checkEnemyOrSafe(enemy)
    # Move to the bottom left X mark.
    hero.moveXY(16, 14)
    # Save the result of findNearestEnemy() in a variable.
    enemy = hero.findNearestEnemy()
    # Call checkEnemyOrSafe(), and pass the
    # result of findNearestEnemy as the argument.
    checkEnemyOrSafe(enemy)

its making my guy run after the people all the way to te left at the top and the 2 peasants are dying


#2

this is what it keeps doing


#3

Twilight Glasses? Those glasses can see through walls.