Perl: the Markov chain saw PerlMonks

### Random Sierpinski Dust

by o0lit3 (Friar)
 on Sep 21, 2004 at 22:23 UTC Need Help??

Just another Fractal obfu:

This will probably only look right in a console at least 50 characters wide and 25 characters tall. I've only tested it on Windows, but it should work on other OS's as well.

```                        +
@A=
(25,0
);@B=(0
,24   +0)
;@C=( 49,24
);@X=(\$")x(40
+9)         ;@_
=(@X,       \$/)x(
25);\$_[     \$A[1*1]
*50   +\$A   [0]   ]=q
/./;+ \$_[\$B [1*1] *1*50
+\$B[0]]=qq/./;\$_[\$C[1]*50
+\$C                     [0]
]="."                   ;@X=(
\$C[0*0]                 ,\$C [1]
);1   *1*               1*1   *1;
while (394>             (join \$",@_
)=~y/.//){do{           \$R=3*rand;@X=
(((         int         ((\$         {(A
,B,C)       [\$R]}       [0*0]       +\$X[0
])/2+.5     )),int(     (\${(A,B     ,C)[\$R]
}[1   *1]   +\$X   [1]   )/2   +.5   +0)   ))}
while \$_[\$Z =\$X[1 ]*50+ \$X[0] +0]=~ /\./; \$_[\$Z
]=".";+system\$^O=~/[wW]in/?"cls":"clear";print@_}

Replies are listed 'Best First'.
Re: Random Sierpinski Dust
by muntfish (Chaplain) on Sep 22, 2004 at 10:34 UTC

Fantastic! That really brightened up my day — thanks!

Works fine on Unix too, with v5.8.0 or later. I got a syntax error Can't modify join in character translation at - line 19, near "y/.//)" with 5.004_04 on Unix but that's probably my fault for running such an old version...

It's been ages since I messed about with this affine transformation stuff, but you've reminded me how cool they can be. Now how about one shaped like a fern?! ;-)

s^^unp(;75N=&9I<V@`ack(u,^;s|\(.+\`|"\$`\$'\"\$&\"\)"|ee;/m.+h/&&print\$&
Re: Random Sierpinski Dust
by Kzin (Acolyte) on Sep 24, 2004 at 19:27 UTC
Woah. Now that rox. You have it working in windows, Muntfish in Unix, and it ran fine in Linux =)
Linux 2.4.20
Slackware 9.0
Perl v5.8.0

##### By Kzin
Re: Random Sierpinski Dust
by Dedalus (Scribe) on Sep 27, 2004 at 17:49 UTC
My perl is too old for this, and my dial up too slow for the new, but never mind. Another initially surprising method of generating the fractal is the following code
```#!perl -l
print\$"x--\$^F,map\$^F&\$_?\$"x2:"/\\",0..\$y++while\$^F<<=pop
which pops a number and uses it for the size of the fractal.
Re: Random Sierpinski Dust
by kappa (Chaplain) on Sep 27, 2004 at 15:28 UTC
5.6 ok too.
Re: Random Sierpinski Dust
by z2a (Initiate) on Sep 28, 2004 at 06:51 UTC
came out realy nice with v5.8.4 on Darwin v8.0.0b1

Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: obfuscated [id://392785]
Approved by Limbic~Region
Front-paged by Limbic~Region
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2023-05-28 14:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?

No recent polls found

Notices?