User:Laurier Rochon/prototyping/l-systems

From XPUB & Lens-Based wiki

L-Systems

Discovery of the day : TURTLE! (not TurtleWorld, the library)

It actually appears that Python has built-in turtle graphics, meaning that we can bypass BOB (being in the 'swampy folder' etc., and just use a 'pointer' triangle, with much clearer methods. [[1]] is the page for it. It's well documented - for example, you can use 'setcoords(x,y)' to set the pointer at the right spot. The method 'getheading' is also tremendously useful in knowing what angle bob is oriented towards. One big problem with turtle vs turtle world : it's slowwwwwwwwwwwwww. Max speed is '10', which equates to about '1' in Turtle World terms.

---

Using basic transformation rules such as :

  • Axiom: F-F-F-F
  • Rule : F -> FF-F-F-F-FF
  • Angle: 90
  • Steps: 4

What the symbols mean

  • F is forward by X pixels
  • + is turn Y degrees
  • - is turn -Y degrees
  • [ is record the current state
  • ] restore the matching last ] state

Will yield something like :

Screenshot-3.png

Other set of rules...

Sss1.png