summaryrefslogtreecommitdiffstats
path: root/lib/Bot/Games/Game/24.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Bot/Games/Game/24.pm')
-rw-r--r--lib/Bot/Games/Game/24.pm3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Bot/Games/Game/24.pm b/lib/Bot/Games/Game/24.pm
index bfa2e2e..d675594 100644
--- a/lib/Bot/Games/Game/24.pm
+++ b/lib/Bot/Games/Game/24.pm
@@ -23,12 +23,15 @@ has solution => (
sub init {
my $self = shift;
+ my ($player) = @_;
+ $self->add_player($player) unless $self->has_player($player);
return $self->generate_24;
}
augment turn => sub {
my $self = shift;
my ($player, $expr) = @_;
+ $self->add_player($player) unless $self->has_player($player);
my $numbers = join ',', sort grep { $_ } split(/[-\+\*\/\(\)]+/, $expr);
my $solution = join ',', sort split(' ', $self->state);