[Solved] Need help with Thornbush Farm

I’m stuck on Thornbush Farm please help me

Sure. We’d be happy to. That’s what this board is for. Just post the code you have so far and we’ll help you. Just remember to use the </> button so we can see the formatting.

Please post your code using the </> symbol a lot of people would be happy to help. For example:

while True:
    enemy = hero.findNearestEnemy()
    if enemy:

Check the FAQ for more details.

Hi, please explain what you need help on so we can help you figure it out :wink:

When i move to the bottom one he never built the fire trap :rage:

To find out why you aren’t building a fire-trap at the bottom cross we need to see what you’re current code is or we have no way of knowing what’s wrong. Please post it as the others have said above. Thanks.

@Deathcombat We need to see your code in order for us to help you.:yum:

ok @Gamestack I will


# Patrol the village entrances.
# Build a "fire-trap" when you see an ogre.
# Don't blow up any peasants!

while True:
    hero.moveXY(43, 50)
    top = hero.findNearestEnemy()
    if top:
        hero.buildXY("fire-trap", 43, 50)
    hero.moveXY(25, 34)
    left = hero.findNearestEnemy()
    # Check if `left` exists.
    enemy = hero.findNearestEnemy()
    if enemy:
        # Build a trap at 25, 34 if the enemy exists.
        hero.buildXY("fire-trap", 25, 34)
    hero.moveXY(43, 20)
    # Set a variable for the bottom enemy.
    bottom = hero.findNearestEnemy()
    # Check if the bottom enemy exists.
    if enemy:
        # Build a trap at 43, 20 if an enemy exists.
        hero.buildXY("fire-trap", 43, 20)

you are not defining enemy. You put the variables for findnearest enemy as top bottom and left so instead of saying “enemy” put top bottom and left according to the list

ok @Archion I will

1 Like