}
+sub get_color
+{
+ my $self=shift;
+ my ($mul,$zahl)=@_;
+ my @zahlen = qw/20 1 18 4 13 6 10 15 2 17 3 19 7 16 8 11 14 9 12 5 25/;
+ my $counter=0;
+ $counter++ while($zahl != shift @zahlen and @zahlen);
+ $mul=0 if $mul >1;
+ my $result = ($counter+$mul )%2;
+ return $result;
+}
+
sub init
{
my $self=shift;
if ($mult =~/^\d$/)
{
die "Unexpected input" if not $number=~/^\d+$/;
+ next if not $self->{current_shoot_count} < $self->{max_shoots_per_player};
$self->shoot($mult,$number);
} elsif ($mult eq 'btn') {
$self->next_player();
$self->reset_game();
} elsif ($mult eq 'quit') {
return;
+ } else {
+ # shitty input
+ next;
}
push @history, Clone::clone($self);
$self->callback('before_shoot');
return ($current_player,$new_round);
}
+sub finish_player_round
+{
+ my $self=shift;
+ $self->{current_shoot_count} = $self->{max_shoots_per_player};
+}
+
sub next_round
{
my $self=shift;
if ($self->{active_player_count}==1)
{
$self->next_player();
- $self->lose();
+ $self->shout('lose');
+ $self->deactivate_current_player($self->{player_count}-$self->{active_player_count}+1);
}
}
if ($self->{active_player_count}==1)
{
$self->next_player();
- $self->win();
+ $self->shout('win');
+ $self->deactivate_current_player($self->{active_player_count});
}
}