Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
12
Task/Sierpinski-triangle/Perl/sierpinski-triangle-1.pl
Normal file
12
Task/Sierpinski-triangle/Perl/sierpinski-triangle-1.pl
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
sub sierpinski {
|
||||
my ($n) = @_;
|
||||
my @down = '*';
|
||||
my $space = ' ';
|
||||
foreach (1..$n) {
|
||||
@down = (map("$space$_$space", @down), map("$_ $_", @down));
|
||||
$space = "$space$space";
|
||||
}
|
||||
return @down;
|
||||
}
|
||||
|
||||
print "$_\n" foreach sierpinski 4;
|
||||
1
Task/Sierpinski-triangle/Perl/sierpinski-triangle-2.pl
Normal file
1
Task/Sierpinski-triangle/Perl/sierpinski-triangle-2.pl
Normal file
|
|
@ -0,0 +1 @@
|
|||
perl -le '$l=40;$l2="!" x $l;substr+($l2^=$l2),$l/2,1,"\xFF";for(1..16){local $_=$l2;y/\0\xFF/ */;print;($lf,$rt)=map{substr $l2 x 2,$_%$l,$l;}1,-1;$l2=$lf^$rt;select undef,undef,undef,.1;}'
|
||||
Loading…
Add table
Add a link
Reference in a new issue