X-Git-Url: https://git.realraum.at/?a=blobdiff_plain;f=dart%2Fdart-fullcricket.pl;h=1823624e7bd25360cffe9ae65b9a82cb2b2b85bb;hb=a6ed211f3bf4130d0bb08a66aacc8f238858a502;hp=fc2065815801a24e7d4301754eec73440014dab2;hpb=d9fed165717827a0bff689d69c6e1d512fcb427c;p=svn42.git diff --git a/dart/dart-fullcricket.pl b/dart/dart-fullcricket.pl index fc20658..1823624 100755 --- a/dart/dart-fullcricket.pl +++ b/dart/dart-fullcricket.pl @@ -6,10 +6,12 @@ use strict; #my $termios = new POSIX::Termios; #$termios->getattr; #my $term = Term::Cap->Tgetent( { OSPEED => $termios->getospeed } ); +my $sieb=1; +my @prim = qw / 2 3 5 7 11 13 17 19 /; sub gueltig{ my ($zahl,$mult) = @_; - return $zahl<6 || $zahl>20; + return $zahl>1; }; @@ -44,7 +46,18 @@ while ( my $schuss = ) if ($score{$current_player}{$zahl}<3) { $score{$current_player}{$zahl}++; - $self_scored; + $self_scored++; + if ($sieb && ($score{$current_player}{$zahl} == 3)) + { + for my $count (2..21) + { + $count = 25 if $count ==21; + if ( ($count % $zahl) == 0) + { + $score{$current_player}{$count} = 3; + } + } + } } else { $scho++; for my $playernum (1..$numplayer) @@ -57,9 +70,9 @@ while ( my $schuss = ) } } } - print $schuss if ($scored || $scho || $self_scored); + print $schuss if ($scored || $self_scored); print "scored\n" if $scored; - print "scho\n" if $scho; + print "scho\n" if $scho && not $scored; } elsif ($mult eq 'btn') { print $schuss; $current_player++; @@ -89,8 +102,8 @@ sub print_score { for my $playernum (1..$numplayer) { - next if not gueltig($i); my $zahl = $i>20?25:$i; + next if not gueltig($zahl); printf STDERR ("%2d %s ",$zahl, '#' x $score{$playernum}{$zahl}. '-' x (3-$score{$playernum}{$zahl})); } print STDERR "\n";