Skip to content

Instantly share code, notes, and snippets.

@fogleman
Created December 30, 2015 16:36
Show Gist options
  • Save fogleman/006e4069348fa163b8ae to your computer and use it in GitHub Desktop.
Save fogleman/006e4069348fa163b8ae to your computer and use it in GitHub Desktop.
Dragon Curve with Turtle Graphics (Python)
import turtle
def turn(i):
left = (((i & -i) << 1) & i) != 0
return 'L' if left else 'R'
def curve(iteration):
return ''.join([turn(i + 1) for i in range(2 ** iteration - 1)])
if __name__ == '__main__':
turtle.showturtle()
turtle.hideturtle()
turtle.speed(0)
i = 1
while True:
if turn(i) == 'L':
turtle.circle(-4, 90, 36)
else:
turtle.circle(4, 90, 36)
i += 1
@manawesome326
Copy link

What on earth...?

@dahanoo
Copy link

dahanoo commented Feb 8, 2019

This is really cool!

Why the strange comments though? Same person talking to themselves:-S

@PrabakaranAero
Copy link

Awesome.

@tavuong
Copy link

tavuong commented Nov 28, 2019

Very nice ! Thanks for your code :)

@emilesilvis
Copy link

emilesilvis commented Apr 3, 2020

@musagenius345
Copy link

Nice

Copy link

ghost commented Jul 25, 2020

Nice man

@srini-pro
Copy link

not workin

@Toyirov
Copy link

Toyirov commented Jan 26, 2022

Nice

@Heromontage
Copy link

Amazing man

@Alief321
Copy link

wow amazing bro

@ahujaesh
Copy link

ahujaesh commented Apr 3, 2022

wow!

@jungi3852
Copy link

what the

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment