Skip to content

Instantly share code, notes, and snippets.

@franklin-e
Created June 29, 2010 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save franklin-e/457139 to your computer and use it in GitHub Desktop.
Save franklin-e/457139 to your computer and use it in GitHub Desktop.
def vector(angle,length):
turnto(angle)
forward(length)
def lcm(values):
'''Returns the least common multiple of a list of integers.'''
values.sort()
biggest = values[-1]
multiplier = 1
while sum([(multiplier * biggest) % value for value in values]) != 0:
multiplier += 1
return biggest * multiplier
def comp_poly(vecs):
'''Multipoly() that draws a closed shape using a minimum number of interations.'''
for i in range(lcm([lcm([360,angle])/angle for angle, length in vecs])):
for angle, length in vecs:
vector(i*angle, length)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment