Help in Double Gaps and Thunderhooves

I am now stuck on Double Gaps and Thunderhooves in Sarven Desert.
I request @brotherofall to help me out.

Howdy…show us what you’ve got so far (code) and screenshots of any errors (if any) and we’ll get you going from there.

For Thunderhooves:

Ok, that’ll work. Have you tried reading the Hints yet? Page 3 might give you the clue you need. (Rather than hard code the coordinates, try using variables to define x and y instead.)

It works but when I advance towards the oasis, the fences don’t get built.
What to do now, @dedreous

post your code again please…this time tho, format it, so I can copy and paste if need. Sometimes, running the troublesome code leads to clearer insights.

while True:
    hero.moveXY(67, 32)
    yak = hero.findNearestEnemy()
    if yak:
        # If yak.pos.y is greater than hero.pos.y
        if yak.pos.y > hero.pos.y:
            # buildXY a "fence" 10m below the yak.
            hero.buildXY("fence", yak.pos.x, yak.pos.y - 10)
        # else:
        elif yak.pos.y < hero.pos.y:
            # buildXY a "fence" 10m above the yak.
            hero.buildXY("fence", yak.pos.x, yak.pos.y + 10)

Here is the code. Try running it.

lol…the yaks were playing “hero ball”!

The problem is how you are trying to move. Think of moveXY as a fire and forget type of command. Once that code is ‘fired’, no other code will be ran, until it completes. Instead, what do you think you should do if there is NO yak?

I didn’t need the template
Here is the code used to win Thunderhooves:

hero.buildXY("fence", 18, 27)
hero.buildXY("fence", 18, 37)
hero.buildXY("fence", 39, 27)
hero.buildXY("fence", 39, 37)
hero.buildXY("fence", 59, 34)
hero.buildXY("fence", 59, 24)
hero.moveXY(66, 32)

The trick is to change the first four y co-ordinates such that your hero survives in order to reach the oasis as the submit changes the place at which the yak comes.

I now neeed help on Double Gaps

heh…it is creative! Here’s how mine looks at the end:


The format should look like this

// buildXY a “fence” 20 meters to something’s right.
hero.buildXY(“fence”, something.pos.x + ???, something.pos.y)

You don’t need to but if you do hero.say(something) you can see there is a value

Although this solution may work, it isn’t an effective solution because if it were longer or random it can be repetitive or unpredictable. Here is a more effective solution however I use ??? so you will still need to fill it in to understand better.


var yak = hero.findNearestEnemy()
if (yak) 
    // If yak.pos.y is greater than hero.pos.y
    if (yak.pos.y > ???) 
        // buildXY a "fence" 10m below the yak.
        hero.buildXY("???", yak.pos.x, yak.pos.y - #)
    // else: 
    elif (yak.pos.y < hero.pos.y)
        // buildXY a "fence" 10m above the yak.
        hero.buildXY(""???", yak.pos.x, yak.pos.y + 10)
    // moveXY right 10m towards the oasis.
    hero.moveXY(hero.pos.x + 10, ???)

@CodingGeek14 I am happy you found a solution for the problem, the solution above teaches you to solve a problem faster and more efficiently. In the case there weren’t visuals or just dealing with data you wouldn’t be able to calculate every step of the problem by hardcoding what to do step by step, especially something bigger. This makes it easier overall.