21
Pavel
https://pavelmorava.com/
Last seen 11 months ago
Member for 10 years, 6 months, 16 days
Difficulty Normal
Author of Sovereign
https://www.royalroad.com/fiction/26615/sovereign
My blog
https://pavelmorava.com/
I like your solution except for one thing. You are way too talkative
fr = c(f, *args, **kwargs)
gr = c(g, *args, **kwargs)
actually,
fr, gr = map(lambda h: c(h, *args, **kwargs), (f,g))
will make you noble and silent man.
PS: Just kidding :) Nice one.
More
You may find useful *set*.
len(set("abcd")) == len("abcd") #{'d', 'a', 'c', 'b'}
while
len(set("aaaa")) != len("abcd") # {'a'}
More
Yeah,
what programming language did you come from?
Are you sure you need globals? Programming with side effect is generally frowned upon.
do_way(first,emptymatrix) ???
What about to pass values you need via return and not to share them via globals?
But I like your style :) I would ne
More
Your solution seems to me similar to mine :)
I like your using "yield from" it is nice feature. Thanks for reminder.
More
In this case if while too much.
You could save some typing using
for i in range(len(state))
More
You dont need
a=[i for i in args]
args is already tuple, it should work just fine.
Or, if you for some reason insist to have list, you can simply convert a=list(args)
There is fine trick in python called unpacking.
# len(args) == 3
a,b,c = args
It is more readable then us
More
You are trying too hard :)
What about simplifying your solution? There is no reason to have
def __add_connections(self, connections):
for connection in connections:
self.add(connection)
More
for row_offset, col_offset in (
(-1, -1), (-1, 0), (-1, 1),
( 0, -1), ( 0, 1),
( 1, -1), ( 1, 0), ( 1, 1)
)
I like that clear style :) It is put nicely.
More
You can make your code more clearer:
timel = time.split(":")
using this:
hours, minutes = time.split(":")
More
I like your coding style though your solution is pretty complicated :) Good work.
More
Pretty interesting. What is this construction if I may ask?
s=__import__('re').sub
More
It is pretty long :) What about to DRY it and make one universal function for each direction?
http://www.zdrojak.cz/clanky/navrhove-principy-dry/
But I like WET principle better :) We Enjoy Typing is sort of cool :)
Good work, though.
More
Is it really that fast to be placed in SPEEDY? I am just curious :) No offense intended.
More
Line 6 is fine idea. I was stupid enough to indicate checked field by extra mark "x". Shame on me :) and thumbs up!
More