From 5d697170e22d75928a361e1c7b1d007632de29c1 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 1 Jun 2009 02:10:39 -0500 Subject: format more methods as bools --- lib/Bot/Games/Game/Ghost.pm | 6 +++--- lib/Bot/Games/Game/Spook.pm | 4 ++-- lib/Bot/Games/Game/Superghost.pm | 4 ++-- lib/Bot/Games/Game/Xghost.pm | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/Bot/Games/Game/Ghost.pm b/lib/Bot/Games/Game/Ghost.pm index f9b3552..3912f52 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'; +command 'has_challenger', formatter => __PACKAGE__->meta->formatter_for('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'); 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'); sub current_player_index { my $self = shift; diff --git a/lib/Bot/Games/Game/Spook.pm b/lib/Bot/Games/Game/Spook.pm index 415c5b4..f15ddfa 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'); 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'); __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 7164ca2..60a58c4 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'); 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'); __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 5adf534..6c783ab 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'); command valid_word_from_state => sub { my $self = shift; my ($word) = @_; return is_substring($self->state, uc($move)); -}; +}, formatter => __PACKAGE__->meta->formatter_for('Bool'); __PACKAGE__->meta->make_immutable; no Bot::Games::OO::Game; -- cgit v1.2.3