]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
Score display cleanups in azgame
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Thu, 25 Jan 2007 23:40:15 +0000 (23:40 +0000)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Thu, 25 Jan 2007 23:40:15 +0000 (23:40 +0000)
data/rbot/plugins/azgame.rb

index 9721d8b8b77c3ed398bb5cb2c6dacc7a6c80b5c0..1046bba39e8e6a94e829bd450005982b78bd30ea 100644 (file)
@@ -70,11 +70,12 @@ class AzGame
     debug "Total score: #{t}"\r
     ret = Hash.new\r
     @tries.each { |k, a|\r
-      ret[k] = [t*a/n, "%d tries" % a]\r
+      ret[k] = [t*a/n, "%d %s" % [a, a > 1 ? "tries" : "try"]]\r
     }\r
     if @winner\r
       debug "replacing winner score of %d with %d" % [ret[@winner].first, t]\r
-      ret[@winner] = [t, "winner"]\r
+      tries = ret[@winner].last\r
+      ret[@winner] = [t, "winner, #{tries}"]\r
     end\r
     return ret.sort_by { |h| h.last.first }\r
   end\r