Skip to content

Commit

Permalink
show hours/minutes for record times
Browse files Browse the repository at this point in the history
  • Loading branch information
jaythomas committed Apr 25, 2013
1 parent 617f0b5 commit 4f5cfab
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 30 deletions.
17 changes: 7 additions & 10 deletions brawl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1714,7 +1714,7 @@ def do_move(player, opponent, wait=true)

def do_counter(player, opponent, c)
unless c[0].type == :counter
say "Play a counter or pass."
notify player, "Play a counter or pass."
return
end
case c[0].id
Expand Down Expand Up @@ -1772,11 +1772,8 @@ def do_counter(player, opponent, c)
end

def elapsed_time
if started
Utils.secs_to_string(Time.now-started).gsub(/\[|\]|"/,'')
else
nil
end
return nil unless started
Utils.secs_to_string(Time.now-started).gsub(/\[|\]|"/,'')
end

def increment_turn
Expand Down Expand Up @@ -2388,13 +2385,13 @@ def show_records(m, params)
@bot.say m.replyto, "Most turns: #{records[:most_turns_user]} " +
"with #{records[:most_turns]} turns."
end
if records[:least_time]
if t = records[:least_time]
@bot.say m.replyto, "Quickest winner: #{records[:least_time_user]} " +
"after #{records[:least_time]} seconds."
"after #{Utils.secs_to_string(t).gsub(/\[|\]|"/,'')}."
end
if records[:most_time]
if t = records[:most_time]
@bot.say m.replyto, "Slowest winner: #{records[:most_time_user]} " +
"after #{records[:most_time]} seconds."
"after #{Utils.secs_to_string(t).gsub(/\[|\]|"/,'')}."
end
end

Expand Down
17 changes: 7 additions & 10 deletions junkyard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1427,7 +1427,7 @@ def do_move(player, opponent, wait=true)

def do_counter(player, opponent, c)
unless c[0].type == :counter
say "Play a counter or pass."
notify player, "Play a counter or pass."
return
end
case c[0].id
Expand Down Expand Up @@ -1485,11 +1485,8 @@ def do_counter(player, opponent, c)
end

def elapsed_time
if started
Utils.secs_to_string(Time.now-started).gsub(/\[|\]|"/,'')
else
nil
end
return nil unless started
Utils.secs_to_string(Time.now-started).gsub(/\[|\]|"/,'')
end

def increment_turn
Expand Down Expand Up @@ -2084,13 +2081,13 @@ def show_records(m, params)
@bot.say m.replyto, "Most turns: #{records[:most_turns_user]} " +
"with #{records[:most_turns]} turns."
end
if records[:least_time]
if t = records[:least_time]
@bot.say m.replyto, "Quickest winner: #{records[:least_time_user]} " +
"after #{records[:least_time]} seconds."
"after #{Utils.secs_to_string(t).gsub(/\[|\]|"/,'')}."
end
if records[:most_time]
if t = records[:most_time]
@bot.say m.replyto, "Slowest winner: #{records[:most_time_user]} " +
"after #{records[:most_time]} seconds."
"after #{Utils.secs_to_string(t).gsub(/\[|\]|"/,'')}."
end
end

Expand Down
17 changes: 7 additions & 10 deletions rumble.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1609,7 +1609,7 @@ def do_move(player, opponent, wait=true)

def do_counter(player, opponent, c)
unless c[0].type == :counter
say "Play a counter or pass."
notify player, "Play a counter or pass."
return
end
case c[0].id
Expand Down Expand Up @@ -1667,11 +1667,8 @@ def do_counter(player, opponent, c)
end

def elapsed_time
if started
Utils.secs_to_string(Time.now-started).gsub(/\[|\]|"/,'')
else
nil
end
return nil unless started
Utils.secs_to_string(Time.now-started).gsub(/\[|\]|"/,'')
end

def increment_turn
Expand Down Expand Up @@ -2266,13 +2263,13 @@ def show_records(m, params)
@bot.say m.replyto, "Most turns: #{records[:most_turns_user]} " +
"with #{records[:most_turns]} turns."
end
if records[:least_time]
if t = records[:least_time]
@bot.say m.replyto, "Quickest winner: #{records[:least_time_user]} " +
"after #{records[:least_time]} seconds."
"after #{Utils.secs_to_string(t).gsub(/\[|\]|"/,'')}."
end
if records[:most_time]
if t = records[:most_time]
@bot.say m.replyto, "Slowest winner: #{records[:most_time_user]} " +
"after #{records[:most_time]} seconds."
"after #{Utils.secs_to_string(t).gsub(/\[|\]|"/,'')}."
end
end

Expand Down

0 comments on commit 4f5cfab

Please sign in to comment.