projects
/
svn42.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
some cleanups still no working
[svn42.git]
/
dart
/
Dart.pm
diff --git
a/dart/Dart.pm
b/dart/Dart.pm
index
634f149
..
cb654bd
100644
(file)
--- a/
dart/Dart.pm
+++ b/
dart/Dart.pm
@@
-81,6
+81,7
@@
sub run
if ($mult =~/^\d$/)
{
die "Unexpected input" if not $number=~/^\d+$/;
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->shoot($mult,$number);
} elsif ($mult eq 'btn') {
$self->next_player();
@@
-90,6
+91,11
@@
sub run
$self->callback('undo');
} elsif ($mult eq 'reset') {
$self->reset_game();
$self->callback('undo');
} elsif ($mult eq 'reset') {
$self->reset_game();
+ } elsif ($mult eq 'quit') {
+ return;
+ } else {
+ # shitty input
+ next;
}
push @history, Clone::clone($self);
$self->callback('before_shoot');
}
push @history, Clone::clone($self);
$self->callback('before_shoot');
@@
-186,6
+192,12
@@
sub get_next_active_player
return ($current_player,$new_round);
}
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;
sub next_round
{
my $self=shift;
@@
-201,7
+213,8
@@
sub win
if ($self->{active_player_count}==1)
{
$self->next_player();
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);
}
}
}
}
@@
-213,7
+226,8
@@
sub lose
if ($self->{active_player_count}==1)
{
$self->next_player();
if ($self->{active_player_count}==1)
{
$self->next_player();
- $self->win();
+ $self->shout('win');
+ $self->deactivate_current_player($self->{active_player_count});
}
}
}
}