Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Sierpinski Triangle

by eyepopslikeamosquito (Chancellor)
on Aug 17, 2002 at 16:16 UTC ( #190877=note: print w/replies, xml ) Need Help??

in reply to Sierpinski Triangle

Here is an alternative solution. This one is a little shorter and strict and warning safe. Also it does not emit an empty first line. I developed it from ideas in previous solutions posted to See golf thread. If the alien golfers take up my challenge, it will be significantly shortened.

$_=$"x((1|1<<(pop||4))-1)."/\\ ";print,s,(?<=\\)..,$&^"\017|",ge,s,$,/\\,while+s+^ ++

Replies are listed 'Best First'.
Re: Re: Sierpinski Triangle
by eyepopslikeamosquito (Chancellor) on Aug 20, 2002 at 06:24 UTC

    Update: The golf dream team of Ton Hospel, Eugene van der Pijll, Mtv Europe and Keith C Ivey whittled 15 strokes from my initial offering:

    #!perl -l $_=$"x2**(pop||4);s'$'/\\',print,s/(?<=\\)../$&^aD^n8/egwhile+s\^ \\

    Here are some other solutions (without default argument) they concocted during their fidgeting:

    $_=$"x(1<<pop);print,s/(?<=\\)../$&^"\17|"/egwhile+s^\n?$^/\\\n^,s\^ \ +\ $_=$"x(1<<pop).$/;print,s/(?<=\\)../$&^"\17|"/egwhile+s^$^/\\^,s\^ \\ -lX $_=$"x2**pop;print,s/(?<=\\)../$&^"\17|"/egwhile+s*$*/\\**s+^ ++ -lX $_=$"x2**pop;print,s/(?<=\\)../$&^"\17|"/egwhile+s-^ (.*)-$+/\\- -l $_=$"x2**pop;s'$'/\\',print,s/(?<=\\)../$&^"\17|"/egwhile+s\^ \\ -l $_=$"x2**pop;s'$'/\\',print,s/(?<=\\)../$&^aD^n8/egwhile+s\^ \\

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://190877]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2016-10-20 22:40 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (283 votes). Check out past polls.