Oooh! Pretty! That's a fractal right? What's it called?
use strict; use Tk; my $phi = 0; my $thisX = 185; my $thisY = 500; my $nextX = 185; my $nextY = 500; my $mw = MainWindow->new; $mw->geometry( "700x700" ); my $c1 = $mw->Canvas( -background => 'black', -height => 700, -width => 700) ->pack; use constant PRINT => 'P'; use constant LEFT => '<'; use constant RIGHT => '>'; my $ax = "P>" x 4 . "P"; $ax =~ s/P/P<P>P>P<P/g for 1 .. 4; for (split //, $ax) { if ($_ eq RIGHT) { # rotate right $phi += 90; $phi -= 360 if $phi >= 360; } elsif ($_ eq LEFT) { # rotate left $phi -= 90; $phi += 360 if $phi < 0; } elsif ($_ eq PRINT) { # print $thisX = $nextX; $thisY = $nextY; if ($phi == 0) { $nextX += 4 } elsif ($phi == 90) { $nextY -= 4 } elsif ($phi == 180) { $nextX -= 4 } elsif ($phi == 270) { $nextY += 4 } $c1->createLine( $thisX, $thisY, $nextX, $nextY, -fill => 'white' ); $mw->update; } } $c1->createText( 350, 350, -text => "P E R L \n M O N K S", -fill => 'white', -width => 300); MainLoop;
__SIG__ printf "You are here %08x\n", unpack "L!", unpack "P4", pack "L!", B::svref_2object(sub{})->OUTSIDE;
In reply to Re: Order Out Of Chaos
by diotalevi
in thread Order Out Of Chaos
by Lysander
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |