Help with `Treasured In Ice`


#1

Hi guys,

I’ve got some problem with the level treasured-in-ice, in particular with isPathClear() method.
Here’s some of my code:

def worthHeadingWest():
    if treasurePickedUp():
        target = exitPosition
    else:
        target = treasurePosition
    return target.x < hero.pos.x and hero.isPathClear(hero.pos, westRoomPos())

In my loop I have:

if worthHeadingWest():
    p = westRoomPos()
    fromDirection = "east"
elif worthHeadingSouth:
    p = southRoomPos()
    fromDirection = "north"
elif worthHeadingEast():
    # blah
elif worthHeadingNorth():
    # blah
hero.moveXY(p.x, p.y)

My character went west for 2 times, then the problem occurs:
South gate is open but west gate is NOT. But my character stood still…
Have I missed something? Any caveats regarding isPathClear method?
(Twilight Glasses)

Any input would be appreciated.

Cheers~


#2

Found my own problem after posting it out and reviewing the code let.
Missing the brackets after worthHeadingSouth… OMG…

Update:
Hm… this strategy doesn’t work…
Tried the hints and it doesn’t give any algorithm…
Any tips on the path finding logic guys?
Thanks heaps!

Update 2:
Tried to think of a way to record a gates[row][column] variable.
Putting True or False in it indicating if the gate is broken or not.
Don’t know if I’m thinking in the correct direction?


#3

I would continue going forward with Update 2’s train of thought. This isn’t an easy level and creating an algorithm is the goal.

Think about different ways to create a 2 dimensional array that would store the information you need to get through the maze.


#4

so did you complete treasured in ice?


#5

This thread has been left alone for 7 months. Try not to revive dead topics. :slight_smile: