
The Fibonacci word may be represented as a fractal as described here:


(Clicking on the above website   (hal.archives-ouvertes.fr)    will leave a cookie.)



For F_wordm start with F_wordCharn=1
Draw a segment forward
If current F_wordChar is 0
Turn left if n is even
Turn right if n is odd
next n and iterate until end of F_word


Task

Create and display a fractal similar to Fig 1.


(Clicking on the above website   (hal.archives-ouvertes.fr)    will leave a cookie.)

using Luxor, Colors
 
function fwfractal!(word::AbstractString, t::Turtle)
    left  =  90
    right = -90
    for (n, c) in enumerate(word)
        Forward(t)
        if c == '0'
            Turn(t, ifelse(iseven(n), left, right))
        end
    end
    return t
end
 
word = last(fiboword(25))
 
touch("data/fibonaccifractal.png")
Drawing(800, 800, "data/fibonaccifractal.png");
background(colorant"white")
t = Turtle(100, 300)
fwfractal!(word, t)
finish()
preview()