X-Git-Url: https://git.realraum.at/?a=blobdiff_plain;f=dart%2FDart.pm;h=3e5dbcae49c67efde6ad78692af34b657c12a1ef;hb=5b65d67a87c56a61669419bd597809815e696aef;hp=d9b37954dd1272c2a89bd6a3ef494b710fc31c68;hpb=0e5aa9dd0b200a8bd5d9b886debfd9b44c451b0f;p=svn42.git diff --git a/dart/Dart.pm b/dart/Dart.pm index d9b3795..3e5dbca 100644 --- a/dart/Dart.pm +++ b/dart/Dart.pm @@ -24,12 +24,18 @@ sub new return $self; } +sub trace_shoot +{ + my $self=shift; + my ($property)=@_; + push @{$self->{trace_shoot}},$property; +} 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/; + 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; @@ -46,6 +52,7 @@ sub init $self->{current_player}=0; $self->{player_count}=@{$self->{player}}; $self->{active_player_count}=$self->{player_count}; + $self->{trace_shoot_data}={}; $self->callback('init'); } @@ -122,12 +129,34 @@ sub shoot { $self->{current_shoot}={mult=>$mult,number=>$number}; $self->{current_shoot_count}++; - return $self->callback('shoot',$mult,$number); + my $result = $self->callback('shoot',$mult,$number); + for my $trace_prop ( @{$self->{trace_shoot}}) + { + push @{$self->{trace_shoot_data}{$self->{current_player}}},$self->get_current_player()->{$trace_prop}; + } + return $result; } else { return 0; } } +sub plot_trace_shoot +{ + my $self=shift; + my $datastr; + for my $player_num (keys %{$self->{trace_shoot_data}}) + { + $datastr.=$self->get_player($player_num)->{name}.':'; + $datastr.= join ',',@{$self->{trace_shoot_data}{$player_num}}; + $datastr.="\n"; + } + chomp $datastr; + my $plotter; + open($plotter,"|./plot.py") or return; + print $plotter $datastr; + close $plotter; +} + sub shout_last_shoot { my $self=shift;