32
Last seen 12 months ago
Member for 11 years, 6 months, 29 days
Difficulty Normal
Why to use set for the list of valid positions?
More
Very short, does the job nicely, though kind of inefficient for real usage
More
Good work. However, there might be a bit more pythonic way to do it. For
example, matrix rotation to right is reverse of rows followed by transpose,
in python
g = [list(l) for l in zip(*reversed(g))]
More
It is questionable if the object oriented approach makes the code more
readable in these small tasks. However, the main algorithm is IMHO a good
choice, so overall good work.
More
I used almost the same approach, only with maps instead of lambdas, so
obviously good work :-)
More
Good code. Maybe a comment explaining the main idea (the point is inside if
it intersects with odd number of edges) would be beneficial.
More
The code is OK.
However, I think it is much easier to keep the key as one string instead of
slicing it to a list of strings.
In that case the search for a character is one liner: x0, y0 =
divmod(key.index(e[0]), 6).
More
The vote is for comments explaining the algorithm. However, the algorithm
itself is not very efficient. A better algorithm is to go backwards from the
bottom of the pyramid, always choosing the bigger of two values.
More
I think it would be better to use ch.isupper() to test uppercase characters.
More
There is exclusive or operator x^y, which could be used instead of (x+y)%2
More