Skip to content

Instantly share code, notes, and snippets.

@deontologician
Created February 16, 2011 06:45
Show Gist options
  • Save deontologician/828967 to your computer and use it in GitHub Desktop.
Save deontologician/828967 to your computer and use it in GitHub Desktop.
import turtle as T
from random import randint
def spiral(linefun, incr=4, angle=30, iterations = 30):
for i in xrange(0,iterations):
linefun(i*incr)
T.left(angle)
def regular_line(length):
T.forward(length)
def fuzzy_line(length):
for i in xrange(0,length):
T.forward(1)
if i % 2 == 0:
T.right(90)
hairlen = randint(0,10)
T.forward(hairlen)
T.right(180)
T.penup()
T.forward(hairlen)
T.pendown()
T.right(90)
if __name__ == "__main__":
T.reset() #put the turtle back at (0,0)
T.speed(0) # set turtle speed to fastest
T.pendown() # ready the turtle for drawing
spiral(fuzzy_line, angle=77) # create our drawing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment