Back to Index

L-Systems

Lindenmayer systems (L-systems) are a way of iterating on a grammar with an initial state and set of rules. The way that I have implemented L-systems are a little bit different than any others that I've seen, and it may be disparate enough that it isn't an L-system at all anymore, but I think it's a more explicit way to express the grammar.

My implementation of the L-system is made up of the following values:






Link to this render

Final string:

Suggested settings:

#axiom=IF-G-G&rules={"F": "F-G+F+G-F", "G": "GG"}&terminal_rules={"F": "MOV 1", "G": "MOV 1", "+": "ROT -120", "-": "ROT 120", "I": "ROT -90"}&iterations=3 #axiom=FX&rules={"X": "X+YF+", "Y": "-FX-Y"}&terminal_rules={"F": "MOV 1", "-": "ROT 90", "+": "ROT -90"}&iterations=9 #axiom=0&rules={"1": "11", "0": "1[0]0"}&terminal_rules={"1": "MOV 1", "0": "MOV 1", "[": "PUSH,ROT -45", "]": "POP,ROT 45"}&iterations=5 #axiom=F--F--F&rules={"F": "F+F--F+F"}&terminal_rules={"F": "MOV 1", "-": "ROT -60", "+": "ROT 60"}&iterations=3 #axiom=IF&rules={"F": "F+F--F+F"}&terminal_rules={"F": "MOV 1", "-": "ROT -85", "+": "ROT 85", "I": "ROT -90"}&iterations=5 #axiom=IF&rules={"F": "+F--F+"}&terminal_rules={"F": "MOV 1", "+": "ROT 45", "-": "ROT -45", "I": "ROT 90"}&iterations=10 #axiom=W&rules={"W": "+++X--F--ZFX+", "X": "---W++F++YFW-", "Y": "+ZFX--F--Z+++", "Z": "-YFW++F++Y---"}&terminal_rules={"F": "MOV 1", "+": "ROT 30", "-": "ROT -30", "[": "PUSH", "]": "POP"}&iterations=5 #axiom=A&rules={"A": "A-B--B+A++AA+B-", "B": "+A-BB--B-A++A+B"}&terminal_rules={"A": "MOV 1", "B": "MOV 1", "+": "ROT 60", "-": "ROT -60"}&iterations=3 #axiom=F+F+F+F&rules={"F": "F+f-FF+F+FF+Ff+FF-f+FF-F-FF-Ff-FFF", "f": "ffffff"}&terminal_rules={"F": "MOV 1", "f": "PUT 1", "-":"ROT 90", "+": "ROT -90"}&iterations=3 #axiom=RF&rules={"F": "FF[[[+F]F]-F]"}&terminal_rules={"[": "PUSH", "]": "POP", "F": "MOV 1", "M": "MOV 1", "-": "ROT 90", "+": "ROT -90", "R": "ROT -45"}&iterations=3 #axiom=X&rules={"X": "F[-X][X]F[-X]+FX", "F": "FF"}&terminal_rules={"F": "MOV 1", "-": "ROT 25", "+": "ROT -25", "[": "PUSH", "]": "POP"}&iterations=5 #axiom=F&rules={"F": "1FF-[2-F+F+F]+[3+F-F-F]"}&terminal_rules={"F": "MOV 1", "-":"ROT 22.5", "+": "ROT -22.5", "[": "PUSH", "]": "POP", "1": "COL #000000", "2": "COL #00FF00", "3": "COL #77FF77"}&iterations=3 #axiom=F&rules={"F": "F[+F]F[-F][F]"}&terminal_rules={"F": "MOV 1", "-":"ROT 20", "+": "ROT -20", "[": "PUSH", "]": "POP"}&iterations=3 #axiom=F&rules={"F":"F-[F]-[F]-[F]"}&terminal_rules={"F":"MOV 1", "[":"PUSH", "]": "POP", "-": "ROT 120", "+": "ROT -120"}&iterations=3 #axiom=FX&rules={"X":"M[-FY]+FX", "Y":"FX+FY-FX"}&terminal_rules={"F":"MOV 1", "[":"PUSH", "]": "POP", "-": "ROT 30", "+": "ROT -30", "M": "MULT .6"}&iterations=3 #axiom=IX&rules={"X": "+FF-YFF+FF--FFFTXTF--YFFFYFFFT", "Y": "-FF+XFF-FF++FFFTYTF++XFFFXFFFT", "F": "GG", "G": "GG"}&terminal_rules={"F": "MOV 1", "G": "PUT 1", "-": "ROT -60", "+": "ROT 60", "I": "ROT -90", "T": "ROT -180"}&iterations=3 #axiom=[X]++[X]++[X]++[X]++[X]&rules={"W":"YF++ZF----XF[-YF----WF]++","X":"+YF--ZF[---WF--XF]+","Y":"-WF++XF[+++YF++ZF]-","Z":"--YF++++WF[+ZF++++XF]--XF","F":""}&terminal_rules={"F": "MOV 1", "-": "ROT -36", "+": "ROT 36", "[": "PUSH", "]":"POP"}&iterations=2