Changes between Initial Version and Version 1 of Ticket #2516, comment 26


Ignore:
Timestamp:
Aug 29, 2014, 10:15:54 PM (10 years ago)
Author:
Jia Henry

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #2516, comment 26

    initial v1  
    1 Replying to [comment:25 leper]:
    2 > Lines 221-224 can be deleted. `[0:something]` is the same as `[:something]`. Check if the code still works with 1vs1s, if it doesn't (which looks like it is the case) use an inline if (roughly a ternary operator) to add the `" and "` only if it is needed.
    3 >
    4 > Lines 198-218 could be improved with some map calls too.
    5 >
    6 > Lines 183-191 can be shortened with two calls to filter. (Use a local var to find the team of a winner (maybe using `next()` (as in `next(game.player_info[i].team for i in game.players if i == game.winner)`))
    7 >
    8 > Lines 151-152: fix the indentation, also make that a real comment, not an explanation of what the code already says; The code above that if can probably be improved (shortened/cleaned up) by removing the special case for 1vs1s.
    9 >
    10 
    11 leper, I think your idea of using map and join overcomplicates things because it makes it harder to follow the logic of the code when compared to Josh's loops which are relatively simple but longer. Also, there now needs to be a special case for 1v1s which just makes things worse.
    12 
    13 Personally I'd just stick with Josh's code as it is simple and it works