rendered paste bodyimport random, mathfrom turtle import *setup(width=1000, height=1000, startx=0, starty=0)mode("logo")speed("Fastest")colormode(255)hideturtle()width = .1def square_rotate(length, turn): for i in range(4): forward(length) right(90 + turn) right(90) color(random.randint(1,255), random.randint(1,255), random.randint(1,255))def square_rotate_corners(length, turn): for i in range(4): penup() forward(length-2) pendown() forward(2) right(90 + turn) right(90) num = random.randint(100,255) color(num,num,num)def square_rotate_lines(length, turn): forward(length) right(90 + turn)def square(length): for i in range(4): forward(length) right(90) color(random.randint(1,255), random.randint(1,255), random.randint(1,255)) def petal(radius): distanceTravelled = 0 circumference = pi * radius * 2 #account for percent error when turning 'curve' into x and y distances color(random.randint(1,255), random.randint(1,255), random.randint(1,255)) while distanceTravelled <= ((4 * circumference) * .73): initial_x = pos()[0] initial_y = pos()[1] segment = radius/10 forward(segment) right(segment) distanceTravelled += abs(pos()[0] - initial_x) + abs(pos()[1] - initial_y) right(90) def spiral(radius, tightness): distanceTravelled = 0 circumference = pi * radius * 2 #account for percent error when turning 'curve' into x and y distances diffraction = 0 while diffraction <= tightness and distanceTravelled <= (circumference * 10): initial_x = pos()[0] initial_y = pos()[1] forward(6) right(1+diffraction) diffraction += 5 distanceTravelled += abs(pos()[0] - initial_x) + abs(pos()[1] - initial_y)def draw_petals(radius, amount): for i in range(amount): petal(radius)def draw_spiral_petals(radius, amount): for i in range(amount): petal(radius) forward(3)def draw_squares(amount): slow_turn = 0 for j in range(amount): square(1.2 * j) slow_turn += 1.5def draw_rot_expand_squares(amount): for j in range(amount): begin_fill() square_rotate(1.2 * j, 2) set_heading(0) forward(10) end_filldef draw_rot_squares(amount): for j in range(amount): square_rotate(1.2 * j, 2) def draw_milky_way(amount): bgcolor(0,0,0) for j in range(amount): square_rotate_experiment(1.2 * j, 2) def draw_max_squares(amount): slow_turn = 0 for i in range(4): for j in range(amount): square(1.2 * j) slow_turn += 1.5 right(90) def draw_circles(radius, amount): for j in range(amount): circle(radius) def draw_spiral(radius, tightness): spiral(radius, tightness)def draw_curve_lines(amount): bgcolor(0,0,0) col_one = 0 col_two = 120 col_three = 255 for j in range(amount): color(col_one,col_two,col_three) square_rotate_lines(1.2 * j, 2) if col_one < 250: col_one += 5 else: col_one = 5 col_one -= 5 if col_two > 0: col_two -= 5 else: col_two = 120 col_two += 5 if col_three < 250: col_three += 5 else: col_three = 255 col_three -= 5def draw_curve_lines_crazy_color(amount): bgcolor(0,0,0) col_one = 0 col_two = 0 col_three = 0 for j in range(amount): rand_one = random.randint(0,255) rand_two = random.randint(0,255) rand_three = random.randint(0,255) color(col_one,col_two,col_three) square_rotate_lines(1.2 * j, 2) if col_one + rand_one < 250: col_one += rand_one elif col_one - rand_one > 0: col_one -= rand_one if col_two + rand_two < 250: col_two += rand_two elif col_two - rand_two > 0: col_two -= rand_two if col_three + rand_three < 250: col_three += rand_three elif col_three - rand_three > 0: col_three -= rand_three done()