summaryrefslogtreecommitdiffstats
path: root/lib/Bot/Games/Game/Xghost.pm
blob: 799d7cec58d59b74ad17366b677d838a56212745 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package Bot::Games::Game::Xghost;
use Bot::Games::OO;
use Games::Word qw/is_substring/;
extends 'Bot::Games::Game::Ghost';

has '+help' => (
    default => "xghost help",
);

command valid_move => sub {
    my $self = shift;
    my ($move) = @_;
    return is_substring($self->state, uc($move))
        && length($self->state) + 1 == length($move);
}, formatter => 'Bool';

command valid_word_from_state => sub {
    my $self = shift;
    my ($word) = @_;
    return is_substring($self->state, uc($word));
}, formatter => 'Bool';

__PACKAGE__->meta->make_immutable;
no Bot::Games::OO;

1;