The OpenNET Project / Index page

[  /+++ | | wiki | | ]

/ "Perl" /

, , , - , , .

:

#!/usr/bin/perl -w
use locale;

%oo=(""=>1, ""=>1, ""=>1);

$b="    ";
$o="    -";
$tw="    ";
$tb="     ";

@m=($b, $o, $tb, $tw); rrand(\@m);
print join "\n", @m,"\n";

for $i(0 .. $#m){
  $h{$i}{$1}++ while $m[$i]=~m!((\w[\w-]*){4,30})!g;
  $vr{$i}=$m[$i];
}

for $r(keys %h){print "\n"; 
  my (@ee, $u, $trr);
  for $n(keys %{$h{$r}}){
    do{
      $t = join " " => $vr{$r};
      $u+=1;
      push @ee => $h{$r}{$n};
    } if exists $oo{$n};
  } 
  print "$t ",$u + $ee[0]-1,"\n";
}

sub rrand{
  my $m = shift; my $i;
  for($i=@$m; --$i;){
    my $j = int rand($i+1);
    net if $i==$j;
    @$m[$i,$j] = @$m[$j,$i]
  }
}

- $b,$o,$tw,$tb, . rrand(), . , . 1(.. , ) $b :

     $b = "    ";

     $h{1}=(
            "" => 3,
            "" => 1,
            "" => 1
           ); 

.. , . , - . ( , ), .

:

     for $r(keys %h){print "\n";
       my (@ee, $u, $trr);
       for $n(keys %{$h{$r}}){
         do{
           $t = join " " => $vr{$r};
           $u++;
           push @ee => $h{$r}{$n};
         } if exists $oo{$n};
       } 
       print "$t ",$u + $ee[0]-1,"\n";
     }

$r, . exists : , , . %vr, $vr{$r}. $u++ , , (). " ", ( ) $u . , $u=2, - $u=3 , .

     push @ee => $h{$r}{$n};

(3,1,1 ) . exists . .. , , + . , , " ", , .. $ee[0]-1( ) , $u. - , . .. , .


:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
:


Created 1996-2023 by Maxim Chirkov
, ,