14
HonzaKral
1 11 26
572/ 945
Last seen 4 years ago
Member for 11 years, 6 months, 4 days
Difficulty Normal
Best reviews / Newest reviews
First-bryukh 3 1
any([ch.isupper() for ch in data]) and Using the any builtin is nice, but why stop there and code the rest using list comprehensions? for method_name in ('isupper', 'isdigit', 'islower'): if not any(map(methodcaller(method_name), data)): return False note thhat i More
Second-bryukh 1 1
I like the use of sets, I chose very similar approach, just started with a full set and kept subtracting invalid guesses. This is probably more optimized but I prefer the clarity of not having to have the special condition (if numbers else new_numbers). More
Pathfinder-zookatron
next = (end[0], end[1], None, 0, 0, dist(end, start)) This is very confusing and hard to read, consider using named tuples instead for clarity - it's super hard to keep track of what next[4] is etc. Also try to avoid using builtin names ('next') for your variable names. More
Pathfinder-zookatron
def path(grid, passable, dist, start, end): What does these variables mean? More
Pathfinder-zookatron
possible = {} There is no need for the done flag, just return when you find a solution. More
Pathfinder-zookatron
consider storing the steps along with their names, that way you can generate all neighbors and know the name of the direction. You can then keep track of the sequence in the next tuple and thus avoid having to translate it at the end with complicated code. More
Pathfinder-zookatron
super long line super unreadable, it's usually good to follow PEP 8 for readability More
Pathfinder-zookatron
start) and eturn the solution More
Pathfinder-zookatron
instead of constantly iterating over the possible values it might be btter to look into some other data structure. queue.PriorityQueue would be ideal. More
Pathfinder-zookatron
direction name in the tuple it would be just a simple matter of retrieving the step names and concatenating them, avoiding the complicated comparisons. More
Pathfinder-zookatron
I don't feel there is any need to inject the dist and passable functions into the path function - just define those as top-level functions or within path and be done with it. Alternatively consider just hard-coding the logic and commenting it. More
Pathfinder-zookatron
This is very confusing and hard to read, consider using named tuples instead for clarity - it's super hard to keep track of what next[4] is etc. Also try to avoid using builtin names ('next') for your variable names. # x, y, next, priority, distance_travelled, distance_to_end More
Sets-HonzaKral 1
ehm, line 10 should have been just guesses &= set(range(rem, 101, div)) More