diff options
author | Jesse Luehrs <doy@tozt.net> | 2009-06-01 02:56:04 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2009-06-01 02:57:29 -0500 |
commit | 8177ff4ccdcc04b636b52aeeb1a0b3d901a60c54 (patch) | |
tree | ae5f3203462d41a0fbd4165d9c4777454f8d4c44 | |
parent | da928b59285b96179db5cecd1325efe3aff1e93b (diff) | |
download | bot-games-8177ff4ccdcc04b636b52aeeb1a0b3d901a60c54.tar.gz bot-games-8177ff4ccdcc04b636b52aeeb1a0b3d901a60c54.zip |
use 'Bool' as the formatter rather than manually looking it up
-rw-r--r-- | lib/Bot/Games/Game.pm | 2 | ||||
-rw-r--r-- | lib/Bot/Games/Game/Ghost.pm | 6 | ||||
-rw-r--r-- | lib/Bot/Games/Game/Spook.pm | 4 | ||||
-rw-r--r-- | lib/Bot/Games/Game/Superghost.pm | 4 | ||||
-rw-r--r-- | lib/Bot/Games/Game/Xghost.pm | 4 |
5 files changed, 10 insertions, 10 deletions
diff --git a/lib/Bot/Games/Game.pm b/lib/Bot/Games/Game.pm index c8641a4..610ee58 100644 --- a/lib/Bot/Games/Game.pm +++ b/lib/Bot/Games/Game.pm @@ -39,7 +39,7 @@ has players => ( command => 1, ); command 'num_players'; -command 'has_player', formatter => __PACKAGE__->meta->formatter_for('Bool'); +command 'has_player', formatter => 'Bool'; has start_time => ( is => 'ro', diff --git a/lib/Bot/Games/Game/Ghost.pm b/lib/Bot/Games/Game/Ghost.pm index 3912f52..43798f7 100644 --- a/lib/Bot/Games/Game/Ghost.pm +++ b/lib/Bot/Games/Game/Ghost.pm @@ -27,7 +27,7 @@ has challenger => ( predicate => 'has_challenger', command => 1, ); -command 'has_challenger', formatter => __PACKAGE__->meta->formatter_for('Bool'); +command 'has_challenger', formatter => 'Bool'; has wordlist => ( is => 'ro', @@ -127,14 +127,14 @@ command valid_move => sub { my $self = shift; my ($move) = @_; return uc(substr($move, 0, -1)) eq $self->state; -}, formatter => __PACKAGE__->meta->formatter_for('Bool'); +}, formatter => 'Bool'; command valid_word_from_state => sub { my $self = shift; my ($word) = @_; my $word_prefix = substr($word, 0, length($self->state)); return uc($word_prefix) eq $self->state; -}, formatter => __PACKAGE__->meta->formatter_for('Bool'); +}, formatter => 'Bool'; sub current_player_index { my $self = shift; diff --git a/lib/Bot/Games/Game/Spook.pm b/lib/Bot/Games/Game/Spook.pm index f15ddfa..cfb577f 100644 --- a/lib/Bot/Games/Game/Spook.pm +++ b/lib/Bot/Games/Game/Spook.pm @@ -12,7 +12,7 @@ command valid_move => sub { my ($move) = @_; return is_subpermutation($self->state, uc($move)) && length($self->state) + 1 == length($move); -}, formatter => __PACKAGE__->meta->formatter_for('Bool'); +}, formatter => 'Bool'; command valid_word_from_state => sub { my $self = shift; @@ -20,7 +20,7 @@ command valid_word_from_state => sub { $word = uc join '', sort split(//, $word); my $state = join '', sort split(//, $self->state); return $word eq $state; -}, formatter => __PACKAGE__->meta->formatter_for('Bool'); +}, formatter => 'Bool'; __PACKAGE__->meta->make_immutable; no Bot::Games::OO::Game; diff --git a/lib/Bot/Games/Game/Superghost.pm b/lib/Bot/Games/Game/Superghost.pm index 60a58c4..f286425 100644 --- a/lib/Bot/Games/Game/Superghost.pm +++ b/lib/Bot/Games/Game/Superghost.pm @@ -11,14 +11,14 @@ command valid_move => sub { my ($move) = @_; return uc(substr($move, 0, -1)) eq $self->state || uc(substr($move, 1)) eq $self->state; -}, formatter => __PACKAGE__->meta->formatter_for('Bool'); +}, formatter => 'Bool'; command valid_word_from_state => sub { my $self = shift; my ($word) = @_; my $state = $self->state; return uc($word) =~ /\Q$state\E/; -}, formatter => __PACKAGE__->meta->formatter_for('Bool'); +}, formatter => 'Bool'; __PACKAGE__->meta->make_immutable; no Bot::Games::OO::Game; diff --git a/lib/Bot/Games/Game/Xghost.pm b/lib/Bot/Games/Game/Xghost.pm index 6c783ab..516fff6 100644 --- a/lib/Bot/Games/Game/Xghost.pm +++ b/lib/Bot/Games/Game/Xghost.pm @@ -12,13 +12,13 @@ command valid_move => sub { my ($move) = @_; return is_substring($self->state, uc($move)) && length($self->state) + 1 == length($move); -}, formatter => __PACKAGE__->meta->formatter_for('Bool'); +}, formatter => 'Bool'; command valid_word_from_state => sub { my $self = shift; my ($word) = @_; return is_substring($self->state, uc($move)); -}, formatter => __PACKAGE__->meta->formatter_for('Bool'); +}, formatter => 'Bool'; __PACKAGE__->meta->make_immutable; no Bot::Games::OO::Game; |