Branching L-Systems
I’ve been trying to figure out L-Systems now for a while after I read about it on Joshua Davis’ now defunct diary a few years ago. Stumbled upon it again on Keith Peters’ Chaos-101 site and felt like looking it up on Wikipedia. Lo and behold, I somehow managed (painstakingly) to figure it out for AS3! You can download the source here. The following is a brief overview of the puzzles i encountered and my solutions.
What is an L-System?
It’s a way of describing plants in a series of letters and symbols (6 to be exact). The symbols are the following:
- F - draw forward
- L - move forward
- + - rotate right by X degrees
- - - rotate left by X degrees
- [ - push (saves the current position and starts a new branch)
- ] - pop (resumes the last saved position starts growing again from there
WTF?
Basically, you’ll start off with a string, like say “L”…think of it as our seed. Now, this is at generation 0 (or N=0). What’s so awesome about L-Systems, is that it’s a parallel rewriting system, meaning, as we iterate through each generation, we replace certain symbols from the previous generation. Here are the rules for what i have in my example above:
L → F-[[L]+L]+F[+FL]-L
F → FF
This means that if we start with L as the first generation, this is what our progression will look like:
read onDreams on Twitter
This is an experiment in connecting Flash to the Twitter Search API using Tweetr, an awesome package/wrapper for AS3. It’s real easy to use. You’ll have to use a proxy though to get around twitter’s cross domain restrictions. Highly recommended! (The proxy only takes PHP5 though, so make sure you have that before installing).
Working on a grander scale project, so this is just a test.
What is an ONEIROI?
The Oneiroi were the dark-winged Daimones (Spirits) of dreams. They emerged each night like a flock of bats from their cavernous home in Erebos, the land of eternal darkness beyond the rising sun. The Oneiroi passed through one of two gates (pylai). The first of these, made of horn, was the source of the prophetic god-sent dreams, while the other, constructed of ivory, was the source of dreams which were false and without meaning. The term for nightmare was melas oneiros (black dream).
According to some the leader of the Oneiroi was Morpheus, a god who appeared in the dreams of kings in the guise of a man, delivering messages from the gods.
read on