Help with "Canyon of Storms"

New to the forum, please be gentle with me if i make mistakes…

Alright so i am 99% sure i am doing this code right but it almost seems like the level itself is broken because the heckin Yaks never move and the level just end with me completing the “return to the cave” objective but not the objective to “Collect coins until storm”. I thought maybe it was just my code but then i looked up solutions for the code but mine is 100% spot on to all the solution samples! I’m not sure what exactly i am doing wrong but ive been at it for over 45 minutes now! I’ve noticed that some of the admins are sticklers for how you format your sample code, but i took a screen cap of my code to show here.

Howdy and welcome! Heh, screenshots are ok, but not optimal, especially when you have more than a screenful of code; snips are perfect for errors and such though. Next time, try this instead: [Essentials] How To Post/Format Your Code Correctly

You are correct, in that your code ‘looks’ spot on. However, it would be best if we could copy and paste it, so to run it on our systems.

Otherwise, have you tried: a different browser; restarting the level, typing in the code from scratch; changing hero?

1 Like
# A desert storm is coming!
# Yaks can detect when a storm is coming.

# This variable will be used as a condition.
yak = hero.findNearestEnemy()

# While there is at least one sand yak:
while yak:
    item = hero.findNearestItem()
    if item:
        hero.moveXY(item.pos.x, item.pos.y)
    # Update the value of the variable `yak`
    # with findNearestEnemy()
    yak = hero.findNearestEnemy()
    
    pass
# The yaks have hidden.
# Move to the red X at the hideout.
hero.moveXY(38,58)

Alright, if i followed the step correctly, i should have pasted this code right.

As for trying a different hero or a different browser, yes i have tried both those option and even tried logging in and out. It doesn’t seem to make a difference. :confused:

Yes, it looks great! It pastes in properly too, which is the intent. However, I ran your code and, pasted directly from what you shared, it passed. That pretty much leaves either equipment, or something really really weird.

Do you have the Ring of Speed? Might be worth a try.

1 Like

70473b68fae6957edd74e8905f5f8ae5

Here is my equipment. Yes, i have the ring of speed equipped. Here is what my screen looks like once the program runs it course.

The yaks never move for some reason and the program stops at roughly 0:28 seconds.

Well, here’s me and my results, with your code…I think it’s getting weirder:
image

@Deadpool198, @Chaboi_3000…Guys, I’m at a loss here. His code runs perfect for me, but fails to complete for him.

Do you think its because i only have a Programmation level 3? I see you have a level 5, but i don’t know where i would get a level 5 since its not in the item shop.

Not sure if this will help but here is what my over world looks like before entering the lesson.

No, you acquire that later on, but I forget where. I have it at this level only because I completed all free levels before I started the subscription (levels). I equipped III and re-ran…it succeeded, still with your code.

Oof! just my luck haha, guess i found a way to break it since my code works for you but not me. I guess i can move on for now, its just frustrating since im trying to complete the entire course.

Until someone else pipes in, how about try unequipping everything except your Speed, glasses and boots, including your pet…yes, I’m grasping at straws here :wink: Speaking of which, try upgrading your glasses…I was using Twilight at the time. Of course, all purchases are final, so you decide if this is worth the spend…no promise it will help.

Just curious, will that work?
/ No need of ring, book or glasses, only boots and a pet /

yak = pet.findNearestByType.call(hero,"sand-yak")
while yak:
    coin = pet.findNearestByType.call(hero,"coin")
    if coin:
        hero.moveXY(coin.pos.x, coin.pos.y ) # or
        # hero.move(coin.pos)
    yak = pet.findNearestByType.call(hero,"sand-yak")
hero.moveXY(38, 58)

Umm, no need for ugraded perhaps, but he does need to be able to findNearest. However, why use pet? As mentioned, his code, exactly as posted, worked fine for me.

However, that is certainly worth trying!

Okay, so for whatever reason, this solution worked for me! Thank you so much for your help. Also, thank you to @dedreous for your replies and help as well. :slight_smile: