Skeleton Puzzle pathfinder code


#1

This is my first post to this forum. My apologies if not using it in the right way. I have been using code combat to learn python. So far has been great fun and a good learning experience. Kudos to all of those involved in creating it.

On the skeleton puzzle level, I was interested in how to solve using some type of path finding algorithm. After researching a couple of sites and using some of the examples, the following code works well in IDLE. But triggers ‘infinite loop’ error in code combat. Please help.

I am swapping between “print” and “hero.say” as output options. I know heapq doesn’t work in code combat. It does speed things up considerably in Idle.

The version below runs and solves the puzzle in IDLE.
For starting puzzle: [[4, 7, 3], [2, 1, 6], [0, 5, 8]]
Solution path as str: 5174271571421458

(I am a subscriber)

“”"

code to solve Code Combat Skeleton Puzzle

(Solution removed)


#2

Please don’t post solutions. The purpose of this board is to help people learn so that they can figure out levels on their own. Simply providing solutions does not help and is counterproductive to this goal. The two main rules here on this board are no swearing and no posting solutions. Thanks and welcome to the board. (BTW, your solution was impressive)