Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Forest Miners confusion


So my husband has the exact same code as me, and passed the level, but for some reason its not letting me do so. The enemy seems like he spawns a second or so too late.

# Check if the mines are safe for the workers.

def checkEnemyOrSafe(target):
    # If target (the parameter) exists:
    if target:
        # Then attack target.
    # Otherwise use say() to call the peasants.

while True:
    # Move to, and check the top right X mark.
    hero.moveXY(64, 54)
    enemy = hero.findNearestEnemy()
    # 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.

So why am I failing?


are you wearing the same gear?


oh, I wasn’t using a fast enough sword…thanks. my bad.