Treasured in ice help pleasee

someone please help me
(i used my code from fragile maze)

distance = 16
move = Vector(distance, 0)
direction = Vector.add(move, hero.pos)
while True:
    while not (hero.isPathClear(hero.pos, direction)):
        move = Vector.rotate(move, Math.PI / 2)
        direction = Vector.add(move, hero.pos)
        # hero.say(direction)
    hero.moveXY(direction.x, direction.y)
    move = Vector.rotate(move, -Math.PI / 2)
    direction = Vector.add(move, hero.pos)

Hmm, as I have mentioned to other people (not that I expect you to have read that) you may need to use a visited array to log where you have already travelled and check that where you move next is not somewhere you’ve already been.
Once you’ve done that you won’t go around in circles any more. It might still not work, if so you can change the direction you rotate the Vector and you’ll probably find your way to the treasure eventually. You could do very clever things to find the closest route to the treasure, but it would take you (and me) a very long time to work out.


Again, please do not use code from GitHub as it often is code that you do not understand. Please, I do not want to have to remind you again.

This is my last warning @ineedhelpwithcoding

Elijah :lion:

1 Like

???this is my code from fragile maze

Whether it’s your code from fragile maze or not, it does seem quite likely that it’s taken from the internet.
Anyway, if it’s really not, or you don’t want to accept it, you still need to pass the level. I think it could be yours considering you’ve chosen not to look at the solution for this level as well.
I think you should at least try my advice and see if you can work it out.


This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.