Created
December 31, 2018 17:46
-
-
Save Lazzlo2096/14544e0c90b7a7f65f702c0cdb6a9c93 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from turtle import * | |
import random | |
k = 4 | |
def my_figure(d, z): | |
step = 100/z | |
kk = 4 | |
dd = 360/k | |
def my_forward(): | |
if d!=1: | |
my_figure(d-1, z*kk) | |
else: | |
forward(step) | |
my_forward() | |
left(dd) | |
my_forward() | |
right(dd) | |
my_forward() | |
right(dd) | |
my_forward() | |
my_forward() | |
left(dd) | |
my_forward() | |
left(dd) | |
my_forward() | |
right(dd) | |
my_forward() | |
#color('red', 'yellow') | |
#begin_fill() | |
speed(9) | |
pu() | |
setposition(-300,200) | |
pd() | |
for t in range(1, 6): | |
red = random.random() | |
green = random.random() | |
blue = random.random() | |
tup = (red, green, blue) | |
pencolor(tup) | |
print(tup) | |
for i in range(k): | |
my_figure(t, 1) | |
right(360/k) | |
#clear() | |
#end_fill() | |
done() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment