summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordoy <doy@tozt.net>2009-04-27 00:43:17 -0500
committerdoy <doy@tozt.net>2009-04-27 00:43:17 -0500
commiteb5197e67e600ceb1e30df3d741c70c5024082db (patch)
treee13a9b85087300c3f4b8a8e8ec39f86ce60838a1
parentd03fe696ce25af4efd63d5a1d2888e5c3d7b12fe (diff)
downloadbot-games-eb5197e67e600ceb1e30df3d741c70c5024082db.tar.gz
bot-games-eb5197e67e600ceb1e30df3d741c70c5024082db.zip
invert the sense of the is_over attribute (make it is_active)
-rw-r--r--lib/Bot/Games.pm4
-rw-r--r--lib/Bot/Games/Game.pm3
-rw-r--r--lib/Bot/Games/Game/24.pm4
-rw-r--r--lib/Bot/Games/Game/Ghost.pm2
4 files changed, 6 insertions, 7 deletions
diff --git a/lib/Bot/Games.pm b/lib/Bot/Games.pm
index cd2d24f..25d6ab6 100644
--- a/lib/Bot/Games.pm
+++ b/lib/Bot/Games.pm
@@ -85,7 +85,7 @@ sub said {
&& (!defined($action) || $action !~ /^-/)) {
$self->$say($game->init($args->{who})) if $game->can('init');
$self->done_init->{$game_name} = 1;
- $self->active_games->{$game_name}->is_over(0);
+ $self->active_games->{$game_name}->is_active(1);
}
return unless defined $action;
@@ -117,7 +117,7 @@ sub said {
$self->$say($turn) if $turn;
}
- if ($game->is_over) {
+ if (!$game->is_active) {
delete $self->active_games->{$game_name};
delete $self->done_init->{$game_name};
}
diff --git a/lib/Bot/Games/Game.pm b/lib/Bot/Games/Game.pm
index 4b848be..1b4310b 100644
--- a/lib/Bot/Games/Game.pm
+++ b/lib/Bot/Games/Game.pm
@@ -45,10 +45,9 @@ has last_turn_time => (
formatter => sub { _diff_from_now(shift) },
);
-has is_over => (
+has is_active => (
is => 'rw',
isa => 'Bool',
- default => 1,
command => 1,
needs_init => 0,
);
diff --git a/lib/Bot/Games/Game/24.pm b/lib/Bot/Games/Game/24.pm
index ed5263d..029bf81 100644
--- a/lib/Bot/Games/Game/24.pm
+++ b/lib/Bot/Games/Game/24.pm
@@ -36,7 +36,7 @@ augment turn => sub {
my $eval = $self->evaluate($expr);
if (defined($eval) && $eval == 24) {
- $self->is_over(1);
+ $self->is_active(0);
return "$player wins! ("
. concise(duration_exact(time - $self->start_time->epoch))
. ")";
@@ -48,7 +48,7 @@ augment turn => sub {
command give_up => sub {
my $self = shift;
- $self->is_over(1);
+ $self->is_active(0);
return $self->solution;
};
diff --git a/lib/Bot/Games/Game/Ghost.pm b/lib/Bot/Games/Game/Ghost.pm
index 1c8f9f7..d1f7267 100644
--- a/lib/Bot/Games/Game/Ghost.pm
+++ b/lib/Bot/Games/Game/Ghost.pm
@@ -85,7 +85,7 @@ command challenge => sub {
return "$word is not valid for state " . $self->state . "!"
unless $self->valid_word_from_state($word);
- $self->is_over(1);
+ $self->is_active(0);
# if there is a challenger, then this is a response by the current
# player, so if it's valid, the challenger loses, otherwise the current
# player loses. if there isn't a challenger, then this is asserting