Created
July 28, 2015 08:03
-
-
Save itarato/af3603996eab8b3f8619 to your computer and use it in GitHub Desktop.
Heighway dragon fractal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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