The Mighty Sand Yak-Broken?

I’m on the level 'The Mighty Sand Yak (1st level in the desert). I used a rather easy-to-do method to avoid all the yaks (by moving the avatar using moveXY instead of proximity. Even though I avoided all yaks, I am unable to submit the python code.
The code goes like this-



 Let yaks get close, then move 10m right to dodge.
 Dodge 4 yaks to complete the level.
 loop:
        # Use "if" to only move when a yak is less than 10m away.
        # Move right by adding to your current X position.
        # Use your Sense Stone to access self.pos.
        self.moveXY(25, 30)
        self.moveXY(35,30)
        self.moveXY(45,30)
        self.moveXY(55,30)


----------
1 Like

The purpose of this level is to use if logic to decide when to move, so that’s probably why the level isn’t passing.

The pseudo code is very clear, try giving it a shot:
Use “if” to only move when a yak is less than 10m away.
Move right by adding to your current X position.
Use your Sense Stone to access self.pos.

Thanks!
Was able to pass the level

1 Like

Hi there i am really stuck on this level.
i used your code but it didnt work.
I was doing python

Hi alinaqighulam,

You’re posting on a topic that’s 5 years old, so the other folk probably aren’t around any more.

Rather than copying code, have a go at writing your own. There’s information in the hints, and sometimes you just have to try things to see if they work. If you’re still stuck, post the code that you’ve done here and we’ll try to help you :smile:.

J.

3 Likes

Yeah, the purpose of the discourse is to help not give out answers. Once you write your own code, show it using the </> and we can give some tips :wink:
-Rachel

1 Like