Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Showcase / L-System fractal tree
- By banister Date 2009-09-13 02:18 Edited 2009-09-13 07:01
this isn't a big deal, but i still think it looks kinda cool.

more than the tree itself though is the code used to define the L-System:

LSystem.new do
    rule "F" => "FF"
    rule "X" => "F-[[X]+X]+F[+FX]-X"
   
    atom "X"
end

which (to my mind at least) is a good example of the expressiveness and flexibility of the ruby language :)

(this was implemented using TexPlay's turtle graphics)
- By adamsanderson Date 2009-09-18 01:15
Looks neat, do you have the source for the L-System code anywhere?
- By banister Date 2009-09-18 02:46 Edited 2009-09-18 13:33
sure, here's the implementation of the L-System itself (starts at around 82):
http://github.com/banister/texplay/tree/master/lib/texplay-contrib.rb

and here's the code for the L-System example:
http://github.com/banister/texplay/tree/master/examples/example_lsystem.rb
- By adamsanderson Date 2009-09-19 15:48
That's pretty neat.  I should really try texplay out sometime.  Thanks for passing on the links.
Up Topic Gosu / Gosu Showcase / L-System fractal tree

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill