Microsoft Small Basic

Program Listing: RZL408
' Fibonacci
' Copyright © 2017 Nonki Takahashi. The MIT License.
' Last update 2017-06-06
' Challenge 2017-06

GraphicsWindow.Title = "Fibonacci"
LF = Text.GetCharacter(10)
f[0] = 0
f[1] = 1
For i = 2 To 19
f[i] = f[i - 2] + f[i - 1]
EndFor
For i = 0 To 19
txt = txt + "f[" + i + "]=" + f[i] + LF
EndFor
max = 12
GraphicsWindow.Width = 4 * f[max]
GraphicsWindow.Height = 4 * f[max - 1]
GraphicsWindow.BrushColor = "#000"
ts = Shapes.AddText(txt)
Shapes.Move(ts, 480, 30)
GraphicsWindow.PenColor = "#999"
Turtle.Speed = 10
Turtle.X = 4 * f[max]
Turtle.Y = 4 * f[max - 1] + 4
For i = max - 1 To 1 Step -1
d = 4 * f[i] * Math.Pi / 180
For a = 1 To 90
Turtle.Move(d)
Turtle.Turn(-1)
EndFor
Turtle.Turn(-90)
Turtle.Move(4 * f[i])
Turtle.Turn(-180)
Turtle.PenUp()
Turtle.Move(4 * f[i])
Turtle.Turn(-90)
Turtle.PenDown()
EndFor
Turtle.Hide()