Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: 1-D Cellular Automata

by ferrency (Deacon)
on Jun 20, 2002 at 18:13 UTC ( #176109=note: print w/replies, xml ) Need Help??

in reply to Re: 1-D Cellular Automata
in thread 1-D Cellular Automata

I like L-systems. A few years ago I wrote an L-system which displayed a Koch snowflake in postscript, for one of the early TPJ obfuscated perl contests, but I don't think it qualified due to the postscript. Maybe I'll post it in the obfuscation section if I can dig it up.

Unfortunately, since then, I haven't found any good turtle-graphics style module to support interesting L-system output. There was (is?) a Graphics::Turtle module (or something similar) in CPAN, but according to the author it was an idea, not an implementation.

However, using postscript for turtle graphics output is pretty easy, if you don't mind using a postscript viewer to look at the output. Instead of rotating your "turtle" and calculating a new (X, Y) based on your angle and a fixed radius, translate your current position to (0, 0), rotate the world around the origin, and then draw a line to (say) (0, 1). Using postscript as my output device, the snowflake generator was under 4 80-character lines long, including unnecessary obfuscation and without any external module dependancies.

I hope this provides some inspiration :) If I don't find my old postscript L-system generator maybe I'll rewrite it and post it here somewhere.


Replies are listed 'Best First'.
Re(2): 1-D Cellular Automata
by gumby (Scribe) on Jun 21, 2002 at 18:50 UTC
    Thanks, great post. I've changed quite a bit of (cut out a lot of) code (and made some refinements) so I've posted a working version.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2020-10-23 22:27 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (241 votes). Check out past polls.