Permalink
Browse files

added a total line to the games output

  • Loading branch information...
1 parent 937140a commit 4bdc0f0ea6cdd86999291be9dd2cd9e47b5eb179 Paul Jimenez committed with Paul Jimenez Aug 5, 2009
Showing with 7 additions and 2 deletions.
  1. +7 −2 devilpoints
View
@@ -134,22 +134,27 @@ def cmd_rank(input):
def cmd_games(input):
plays = {}
+ total = 0
for game, players in input:
plays[game] = plays.get(game,0) + 1
+ total += 1
maxplaystrlen = len(str(max(plays.values())))
gamefmt = "{0:>" + str(maxplaystrlen) + "} {1}"
debug("gamefmt = " + gamefmt)
+
+ print("{0} plays of {1} games:\n".format(total,len(plays)))
for game, playcount in reversed(sorted_byval(plays)):
print(gamefmt.format(playcount,game))
+
+
+
cmdlist = {
"score" : cmd_rank,
"games": cmd_games
}
-
-
if __name__ == '__main__':
cmds = cmdlist.keys()

0 comments on commit 4bdc0f0

Please sign in to comment.