11
Peter.White
1 10 28
548/ 645
Last seen 3 years ago
Member for 9 years, 1 month, 28 days
Difficulty Normal
Best reviews / Newest reviews
First-nooodl
Very nice. I used a dictionary, but I can see the benefit of a presorted list here. More
First-gautamas 1
Your __while__ condition and the __return__ on line 16 are redundant. If __number__ happens to be less or equal to 0, line 6 catches that. And since there is no __break__ anywhere, line 16 is unreachable code. More
yield each wave-sevaader
Nice demonstration of a generator. Even though I have never used one, your code is very clear and understandable. Maybe I wouldn't have used the arrival metaphor, because the old ones _don't_ arrive, they are there already. ;) But that's about all I have to criticize. More
First-gyahun_dash
I had to giggle a little while reading the code. ;) Very nice. More
BFS-Kwentar 1
Line 6: __range(len(names_of_rel))__ would be more flexible, in case someone decided to put multi-level connections in __network__. ;) Lines 7 through 11: You use __names_of_rel[i]__ _four times_ and __names_of_rel[1-i]__ twice. Those are list operations, which cost time, but the values don't chang More
First-kazuau 1
Your RE is a bit repetitious. if re.search(r'([a-z]+\s){2}[a-z]+', words, re.IGNORECASE): is shorter and somewhat clearer in my opinion. Anyway, I don't like throwing REs at everything, when there are simpler means available. **str.isalpha()** is a built-in method, so no need to **import re**. More
o, safe pawns...-veky 7 1
How do you not get headaches when writing something like this? I get them just from _reading_ it. ;) More
First-Kerulen 2
If I have to scroll horizontally to read it, it is not clear. -1 for bad style. The approach I like. I used the same. More
First-barrenzye
Reading your comments I was somehow reminded of [The Zen of Python](http://www.thezenofpython.com/): > Readability counts. > > If the implementation is hard to explain, it's a bad idea. Sorry. But why not simply go through the pawn one at a time calculate where another pawn must be to protect it More
First-Blukano
Your checks on lines 5 and 9 are pointless. You do member checking against **pawns** one lines 13 and 15. So, if you happen to check an illegal position, meaning it is outside the board, it will be a miss anyway. Also, if have to do such checks, < and > are better options in my opinion. One keystrok More
First-volatilecat
Could have saved yourself the -97. It's all relative, literally. ;) And **pawns** is already a set, which you basically make a copy of. More
First-jcg
Your comments are misleading: > returns **row number** for pawn p as **"c3"** (first row is 0) And you have five, repeat five, functions? And all are oneliners. Anyway, **is_safe()** checks against all pawns on the board, which you must account for in line 13. Also, the task was to check if a pawn More
First - using string.-tigelane
A little complicated. Plus, you don't need **string**. You can use ord() to get the ASCII number of a character and chr() reverses that. You also potentially check _all_ other _pawns'_ positions, but you only need to check _two_ positions and see if there is a pawn on it. And we were given a set, w More
First-veky 1 1
Lol, I also had the idea to use a dictionary and enumeration. But somehow it didn't cross my mind to just use enumerate directly, so I put it in a dict comprehension. Silly me. ;) Oh, the use of recursion is nice too. At one point I thought about it and then dismissed it after failing to find the r More
First-laserpez
**int()** is redundant for a division of integers. Also, it is basically the same as number//other_number More
First-lukas.linhart 1 1
Nice approach. But it took me a while to grasp what's happening. I'd say that makes it a little less clear. ;) Oh, and line 19 should be the other way around: if state[0] != '.' and len(set(state)) == 1: # no point for set() if [0] is '.' But that's just a minor thing. More
First-e.roboda
Finally I see someone with the same idea of zipping the list. ;) I just found out that reversed(zip(*game_result)) is a 90 degree left rotation of the matrix. That makes the check of the diagonals a breeze. Have a look: http://www.checkio.org/mission/x-o-referee/publications/Peter.White/python-27/ More
First-panaro32 1
I like the nested list comprehension. Also nice use of enumeration. Lines 4 and 5 are repetitious, though, but pragmatic I guess. More
Second-gyahun_dash
Nice. But the last line I don't like all that much. There is a variable in there, the player. The two **ifs** are basically the same only different players. More
Straight Forward-makernaren 1 1
Oh dear! There is not a single iteration in there. I hope your fingers hurt after typing that. ;) More
1
2 3 4