Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Hello, sorry for answering so late, but I only just came back from holidays ^^'
Your solution is not very efficient, but it should actually be enough. What's preventing you from solving the puzzle are these three lines:
Here, you run coordi(maze) and you check if it actually returned a path or if it returned
None
. And when it returns a path, you run it AGAIN to store that path in the variablecoordinates
. This function contains about all the complexity of the kata, so you're basically running your whole program twice on every valid maze.Just changing this to run the function once instead of twice is enough to validate in ~10s, then you can see how other warriors implemented if you want to go further.
As Blind4Basic said, you can print the maze you're failing to solve with a simple print of the input (i.e:
print("\n".join(maze))
). If it may help, the error traceback tells you that you fail while trying to solve an unsolvable maze (meaning the maze is semantically valid, but there is no way out), on the linecurrent = visited[current]
wherecurrent
has value(0, 4)
. That seems to make sense because the cell [0, 4] is not reachable by the player in this maze ;)@B4B: How on Earth can you be so reactive on puzzles that you did not even create? Are you actually a robot ? :D
you have access to them: just print the input to the console.
mmmmmh.... Lemme think about it again...
Well, there are actually 2 approaches. One is to do some/most of the work with regexp, carfully/wisely choosing what stuff you remove. The other is to scan one time through the whole string nd gather all the data you need "one shot", making the simplifications and transpiling on the fly.
From there, it's hard to tell what will or will not do with the regex approach. I personaly used the other method, actually...
(deleted: double post again... x/ )
this way , you're still going through the whole string for each element of
legal
andillegal
. CCL: build one single regex that will do all the replacements one shot. ;)