[Solved] Need help with Thornbush Farm


#1

I’m stuck on Thornbush Farm please help me


#2

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.


#3

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:
        hero.attack(enemy)


#4

Check the FAQ for more details.


#5

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


#6

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


#7

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.


#8

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


#9

ok @Gamestack I will


#10

There

# 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)


#11

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


#12

ok @Enderlord832 I will