Skip to content

Instantly share code, notes, and snippets.

@itarato
Created July 28, 2015 08:03
Show Gist options
  • Save itarato/af3603996eab8b3f8619 to your computer and use it in GitHub Desktop.
Save itarato/af3603996eab8b3f8619 to your computer and use it in GitHub Desktop.
Heighway dragon fractal
import turtle
limit = 6
frac = 0.8
def draw(size, inv = False):
if size > limit:
t.lt(90)
draw(size * frac)
else:
t.fd(size)
t.lt(90) if inv else t.rt(90)
if size > limit:
draw(size * frac, True)
t.rt(90)
else:
t.fd(size)
t = turtle.Turtle()
t.speed(0)
t.seth(0)
draw(1000)
win = turtle.Screen()
win.exitonclick()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment