On 2/9/07, Pit Capitain <pit / capitain.de> wrote: > Harold Hausman schrieb: > > On 2/9/07, Pit Capitain <pit / capitain.de> wrote: > >> Do you have a picture of what it would look like? > > > > I do! > > http://www.danceliquid.com/images/LS/Dragon.png > > > > Also, here's some related information: > > http://www.math.okstate.edu/mathdept/dynamics/lecnotes/node17.html > > Thanks for the picture and the interesting read. In return, here's a > simpler version of your iterate method. This only works for context-free > L-systems and assumes the rules are given as a hash, but its much shorter: > > class LSystem > def iterate > @output.gsub!( /./ ) { |letter| @rules[ letter ] || letter } > end > end > > the_rules = { > "F" => "", > "Y" => "+FX--FY+", > "X" => "-FX++FY-", > } > Ah! I knew (and was secretly hoping) that would happen. :P And *that* is one of my favorite parts about Ruby. Highest Regards, -Harold