From: Giuseppe Bilotta Date: Thu, 25 Jan 2007 23:40:15 +0000 (+0000) Subject: Score display cleanups in azgame X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=47f9d8ac16010d034373b1a2959778d391987909;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git Score display cleanups in azgame --- diff --git a/data/rbot/plugins/azgame.rb b/data/rbot/plugins/azgame.rb index 9721d8b8..1046bba3 100644 --- a/data/rbot/plugins/azgame.rb +++ b/data/rbot/plugins/azgame.rb @@ -70,11 +70,12 @@ class AzGame debug "Total score: #{t}" ret = Hash.new @tries.each { |k, a| - ret[k] = [t*a/n, "%d tries" % a] + ret[k] = [t*a/n, "%d %s" % [a, a > 1 ? "tries" : "try"]] } if @winner debug "replacing winner score of %d with %d" % [ret[@winner].first, t] - ret[@winner] = [t, "winner"] + tries = ret[@winner].last + ret[@winner] = [t, "winner, #{tries}"] end return ret.sort_by { |h| h.last.first } end