def draw_s(t, n): fd(t, n / 2) arc(t, n / 2, 180) arc(t, n / 2, -180) fdlt(t, n / 2, -90) skip(t, 2 * n) lt(t)
def draw_j(t, n): beam(t, n, 2) arc(t, n / 2, 90) fd(t, 3 * n / 2) skip(t, -2 * n) rt(t) skip(t, n / 2)
def bump(t, n, height): """Makes a bump with radius n at height*n """ stump(t, n * height) arc(t, n / 2.0, 180) lt(t) fdlt(t, n * height + n)
def petal(t, r, angle): """Draws a petal using two arcs. t: Turtle r: radius of the arcs angle: angle (degrees) that subtends the arcs """ for i in range(2): arc(t, r, angle) t.lt(180 - angle)
def print_spiral1(t): l = 1 while l < 400: arc(t, l, 60) if l < 10: l += 2 elif l < 20: l += 5 else: l += 10
def print_spiral2(t, cte): l = 1 while l < 400: arc(t, l, 60) l *= cte