from turtle import * from random import choice T, D = 8, 4 xy = (0,0), (1,0), (1,1), (0,1) pensize(2) speed(0) hideturtle() a = ( (1, 1, 1),(2, 2, 1),(3, 3, 1), (4, 4, 1),(5, -0.5, 2),(7, -1, 1), (10, -6, 1),(11, -5, 1),(12, -4, 1), (13, -0.5, 2),(15, -1, 1),(18, -0.5, 2), (23, -1, 1),(26, -0.5, 2) ) def arc(n, d, r): penup() if n < T: x, y = n, 0 elif n < 2 * T: x, y = T, n - T elif n < 3 * T: x, y = 3 * T - n, T else: x, y = 0, 4 * T - n goto(-160 + T * D * u, -110 + T * D * v) setheading(90 * h + 90) right(90) fd(D * x) left(90) fd(D * y) left(n // 8 * 90) pendown() circle(int(D * d), 90 * r) for c in range(10): for l in range(7): h = choice(range(4)) u, v = c + xy[h][0], l + xy[h][1] for (n, d, r) in a: arc(n, d, r)