summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordoy <doy@tozt.net>2009-04-27 00:28:32 -0500
committerdoy <doy@tozt.net>2009-04-27 00:28:32 -0500
commitf14145ab982aee807b65ecbc1a6ea82b6657bb0e (patch)
tree571aa78325f878a8deb2fca2f59b27304f9144ab
parent6322ffbfd2f6d109dde80d8e7c4847be27a4db43 (diff)
downloadbot-games-f14145ab982aee807b65ecbc1a6ea82b6657bb0e.tar.gz
bot-games-f14145ab982aee807b65ecbc1a6ea82b6657bb0e.zip
give the time it took to solve a 24 problem when a correct answer is given
-rw-r--r--lib/Bot/Games/Game/24.pm5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Bot/Games/Game/24.pm b/lib/Bot/Games/Game/24.pm
index b5f50ad..ed5263d 100644
--- a/lib/Bot/Games/Game/24.pm
+++ b/lib/Bot/Games/Game/24.pm
@@ -4,6 +4,7 @@ extends 'Bot::Games::Game';
use List::Util qw/shuffle/;
use Math::Expression::Evaluator;
+use Time::Duration;
has '+help' => (
default => '24 help',
@@ -36,7 +37,9 @@ augment turn => sub {
my $eval = $self->evaluate($expr);
if (defined($eval) && $eval == 24) {
$self->is_over(1);
- return "$player wins!";
+ return "$player wins! ("
+ . concise(duration_exact(time - $self->start_time->epoch))
+ . ")";
}
else {
return "$expr = " . (defined($eval) ? $eval : 'undef');