An implementation of Bresenham's line and circle drawing algorithms and deterministic context-free L systems
Following are few of the results produced:
-
A Gulmohar-like tree:
Axiom: S
Production rules:
S -> FB B -> F[+BLMR]F[-BMR]F[+BL][-BLMR] F -> FN N -> F L -> [G-G][-G+G]--[G-G][-G+G]++++[G-G][-G+G]-- R -> Y[MP][/MP][\MP]
Phenotypes:
F -> (DRAW_FORWARD, 10.0, brown) G -> (DRAW_FORWARD, 5.0, green) M -> (MOVE_FORWARD, 2.0) Y -> (DRAW_CIRCLE, 1.0, yellow) P -> (DRAW_CIRCLE, 2.0, red) [ -> (SAVE) ] -> (RETURN) + -> (ROTATE, +22.5) - -> (ROTATE, -22.5) / -> (ROTATE, -36) \ -> (ROTATE, 36)
Results:
-
A blueberry plant:
Axiom: S
Production rules:
S -> B B -> FL[++LBLMR]FL[+BLMR]--FLR[BLMR]++ L -> //[G/G][/G\G]\[G/G][/G\G]\\[G/G][/G\G]\[G/G][/G\G]// R -> Y[MP][//MP][////MMP][\\MP][\\\\MMP]
Phenotypes:
F -> (DRAW_FORWARD, 20.0, brown) G -> (DRAW_FORWARD, 7.0, green) M -> (MOVE_FORWARD, 2.0) P -> (DRAW_CIRCLE, 2.0, indigo) [ -> (SAVE) ] -> (RETURN) + -> (ROTATE, +15) - -> (ROTATE, -15) \ -> (ROTATE, +22.5) / -> (ROTATE, -22.5)
Results:
-
Dried Grass:
Axiom: W
Production rules:
V -> [+++W][---W]YV W -> +X[-W]Z X -> -W[+X]Z Y -> YZ Z -> [-FFF][+FFF]F
Phenotypes:
F -> (DRAW_FORWARD, 7.5, brown) [ -> (SAVE) ] -> (RETURN)
Results: