21
Jacob Egner
https://github.com/jmegner/CheckioPuzzles
Last seen 4 years ago
Member for 8 years, 11 months, 8 days
Difficulty Normal
I keep a repo of my solutions at:
https://github.com/jmegner/CheckioPuzzles
Whoops, this puzzle is from scientific expedition island, not elementary island.
More
And I no longer need itertools! See github repo for [most recent version of the file](https://github.com/jmegner/CheckioPuzzles/blob/master/the-square-chest.py).
More
your line of code matched my solution character-for-character; just so you know, someone else used a collections.Counter for a more efficient way to detect duplicates;
More
good use of list comprehension; someone else used collections.Counter for more efficient duplicate detection;
Some style notes: 'i' is usually for indices, not elements; binary operators usually have spaces on both sides;
More
hard-to-understand one-liners are bad; break it up into named intermediate results
More
just so you know, the sorted() built in function can take custom key functions so you can sort elements in custom ways
for instance, sorted(numbers_array, key = abs) will sort the array using the abs function as the basis for sorting
More
Takes a while on some of the tests where you have open areas for lots of path possibilities AND bottlenecks to cause trouble with most paths.
Ideas for improvement that I hope to implement in future versions:
* When checking if other paths are blocked, also do some smart force-move pathing to see
More
Note: you'll see a lot of solutions that start at an odd-degree vertex and then travel to whatever adjacent vertex has the most untraveled edges remaining. I have a forum post detailing why I think that method is insufficient, and propose a test case to demonstrate the shortcoming of that method.
More