summaryrefslogtreecommitdiffstats
path: root/lib/Bot/Games/Game
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Bot/Games/Game')
-rw-r--r--lib/Bot/Games/Game/24.pm4
-rw-r--r--lib/Bot/Games/Game/Ghost.pm2
-rw-r--r--lib/Bot/Games/Game/Ghostlike.pm10
-rw-r--r--lib/Bot/Games/Game/Spook.pm8
-rw-r--r--lib/Bot/Games/Game/Superghost.pm2
-rw-r--r--lib/Bot/Games/Game/Xghost.pm2
6 files changed, 14 insertions, 14 deletions
diff --git a/lib/Bot/Games/Game/24.pm b/lib/Bot/Games/Game/24.pm
index 039b551..cbe0edc 100644
--- a/lib/Bot/Games/Game/24.pm
+++ b/lib/Bot/Games/Game/24.pm
@@ -39,9 +39,9 @@ sub turn {
else {
return $eval;
}
-}
+};
-command give_up => {
+command give_up => sub {
my $self = shift;
$self->is_over($self->solution);
return;
diff --git a/lib/Bot/Games/Game/Ghost.pm b/lib/Bot/Games/Game/Ghost.pm
index 1d65683..82baf3b 100644
--- a/lib/Bot/Games/Game/Ghost.pm
+++ b/lib/Bot/Games/Game/Ghost.pm
@@ -7,7 +7,7 @@ has '+help' => (
default => "ghost help",
);
-command valid_move => {
+command valid_move => sub {
my $self = shift;
my ($move) = @_;
return uc(substr($move, 0, -1)) eq $self->state;
diff --git a/lib/Bot/Games/Game/Ghostlike.pm b/lib/Bot/Games/Game/Ghostlike.pm
index e6bad0e..5337760 100644
--- a/lib/Bot/Games/Game/Ghostlike.pm
+++ b/lib/Bot/Games/Game/Ghostlike.pm
@@ -73,7 +73,7 @@ sub turn {
return $self->state($state);
}
-command challenge => {
+command challenge => sub {
my $self = shift;
my ($word, $args) = @_;
my $player = $args->{player};
@@ -101,21 +101,21 @@ command challenge => {
}
};
-command previous_player => {
+command previous_player => sub {
my $self = shift;
return unless $self->has_current_player;
return $self->players->[$self->current_player_index - 1];
};
-command next_player => {
+command next_player => sub {
my $self = shift;
return unless $self->has_current_player;
return $self->players->[($self->current_player_index + 1) % $self->num_players];
};
-command valid_move => { 1 };
+command valid_move => sub { 1 };
-command valid_word_from_state => {
+command valid_word_from_state => sub {
my $self = shift;
my ($word) = @_;
return uc($word) eq $self->state;
diff --git a/lib/Bot/Games/Game/Spook.pm b/lib/Bot/Games/Game/Spook.pm
index 2ec4e2e..5780953 100644
--- a/lib/Bot/Games/Game/Spook.pm
+++ b/lib/Bot/Games/Game/Spook.pm
@@ -8,20 +8,20 @@ has '+help' => (
default => "spook help",
);
-command valid_move => {
+command valid_move => sub {
my $self = shift;
my ($move) = @_;
return is_subpermutation($self->state, uc($move))
&& length($self->state) + 1 == length($move);
-}
+};
-command valid_word_from_state => {
+command valid_word_from_state => sub {
my $self = shift;
my ($word) = @_;
$word = uc join '', sort split(//, $word);
my $state = join '', sort split(//, $self->state);
return $word eq $state;
-}
+};
__PACKAGE__->meta->make_immutable;
no Bot::Games::OO;
diff --git a/lib/Bot/Games/Game/Superghost.pm b/lib/Bot/Games/Game/Superghost.pm
index f6a4d7b..df297ee 100644
--- a/lib/Bot/Games/Game/Superghost.pm
+++ b/lib/Bot/Games/Game/Superghost.pm
@@ -7,7 +7,7 @@ has '+help' => (
default => "superghost help",
);
-command valid_move => {
+command valid_move => sub {
my $self = shift;
my ($move) = @_;
return uc(substr($move, 0, -1)) eq $self->state
diff --git a/lib/Bot/Games/Game/Xghost.pm b/lib/Bot/Games/Game/Xghost.pm
index 8f9092d..0c44cff 100644
--- a/lib/Bot/Games/Game/Xghost.pm
+++ b/lib/Bot/Games/Game/Xghost.pm
@@ -8,7 +8,7 @@ has '+help' => (
default => "xghost help",
);
-command valid_move => {
+command valid_move => sub {
my $self = shift;
my ($move) = @_;
return is_substring($self->state, uc($move))