I am currently reading the book "The Fractal Geometry of Nature" by Benoit Mandelbrot. I tried to write a program to visualize some of the curves found in the book by using L-system replacement methods. For some of the curves one can find the rules quite easily, however for this curve I was not able to. Does anyone have a clue? I included a screenshot of the generator displayed in the book. Any help would be appreciated!
According to this page, the equivalent L-system would be:
Axiom: L
L = L+R-L-R
R = L+R+L-R
For which we can write a short Python turtle program to confirm:
from turtle import Screen, Turtle
AXIOM = "L"
RULES = {
'L': "L+R-L-R",
'R': "L+R+L-R"
}
LEVELS = 5
DISTANCE = 40
string = AXIOM
for _ in range(LEVELS):
string = "".join(RULES.get(character, character) for character in string)
screen = Screen()
turtle = Turtle()
turtle.speed(0) # because I have no patience
for character in string:
if character in '-+':
turtle.right([-90, 90][character == '+'])
else:
turtle.forward(DISTANCE / LEVELS)
screen.exitonclick()