from turtle import *
import random
from math import sin, cos, pi

def make_mark(col):
    pd()
    color(col)
    for i in range(4):
        fd(10)
        bk(10)
        lt(90)
    pu()
    update()

def ellipse(a, b):
    pos_x = xcor()
    pos_y = ycor()
    begin_fill()
    pu()
    goto(pos_x + a, pos_y)
    pd()
    for i in range(361):
        t = 2 * pi * i / 360
        goto(pos_x + a * cos(t), pos_y + b * sin(t))
    end_fill()
    pu()
    goto(pos_x, pos_y)

def face(x, y, streuung_1, streuung_2, scale_factor):   # 0.05   0.02   2
    x, y = pos()
    scale_width = random.gauss(1, streuung_1)
    #print(scale_width)
    skull_width_1 = 90 * scale_width * random.gauss(1, streuung_2)
    skull_height_1 = 95 * random.gauss(1, streuung_2)
    skull_width_2 = 75 * scale_width * random.gauss(1, streuung_2)
    skull_height_2 = 100 * random.gauss(1, streuung_2)
    hair_pos = 60 * random.gauss(1, streuung_2)
    hair_width = 50 * scale_width * random.gauss(1, streuung_2)
    hair_height = 20 * random.gauss(1, streuung_2)
    dist_nose_bridge = 10 * random.gauss(1, streuung_2)
    bridge_width = 20 * scale_width * random.gauss(1, streuung_2)
    nose_bridge = 35 * random.gauss(1, streuung_2)
    nose_width = 30 * scale_width * random.gauss(1, streuung_2)
    nose_height = 5 * random.gauss(1, streuung_2)
    mouth_width = 60 * scale_width * random.gauss(1, streuung_2)
    mouth_height = 10 * random.gauss(1, streuung_2)
    dist_nose_mouth = 40 * random.gauss(1, streuung_2)
    diff_skull_1_skull_2 = 50 * random.gauss(1, streuung_2)
    eye_pos = 35 * scale_width * random.gauss(1, streuung_2)
    eye_width = 20 * scale_width * random.gauss(1, streuung_2)
    eye_height = 9 * random.gauss(1, streuung_2)
    ear_width = 10 * scale_width * random.gauss(1, streuung_2)
    ear_height = 35 * random.gauss(1, streuung_2)
    ear_pos = 50 * random.gauss(1, streuung_2)
    
    color("#b3a88f")
    rt(90)
    ellipse(skull_width_1 / scale_factor, skull_height_1 / scale_factor)
    color("#ebdebe")
    ellipse((skull_width_1 - 20) / scale_factor, (skull_height_1 - 20) / scale_factor)
    fd(diff_skull_1_skull_2 / scale_factor)
    ellipse(skull_width_2  / scale_factor, skull_height_2 / scale_factor)  #------
    bk(diff_skull_1_skull_2 / scale_factor)
    #make_mark("orange")
    #update()
    #ch = input()
    color("#b3a88f")
    #bk(hair_pos / scale_factor)
    #ellipse(hair_width / scale_factor, hair_height / scale_factor)
    #fd(hair_pos / scale_factor)
    lt(90)
    fd(eye_pos / scale_factor)
    color("#f0f2f7")
    ellipse(eye_width / scale_factor, eye_height / scale_factor)
    bk(2 * eye_pos / scale_factor)
    ellipse(eye_width / scale_factor, eye_height / scale_factor)
    fd(eye_pos / scale_factor)
    rt(90)
    fd(dist_nose_bridge / scale_factor)
    color("#decda2")      # ede6d3
    pensize(bridge_width / scale_factor)
    pd()
    fd(nose_bridge / scale_factor)
    pensize(nose_width / scale_factor)
    fd(nose_height / scale_factor)
    pu()
    pensize(1)
    fd(dist_nose_mouth / scale_factor)
    lt(90)
    pd()
    color("#bf93a5")
    pensize(mouth_height / scale_factor)
    fd((mouth_width/2)/scale_factor)
    bk(mouth_width / scale_factor)
    fd((mouth_width/2) / scale_factor)
    rt(90)
    pensize(1)
    pu()
    bk(ear_pos / scale_factor)
    #"""
    color("#f0e6cc")
    lt(90)
    fd((skull_width_2 + ear_width) / scale_factor)
    ellipse(ear_width / scale_factor, ear_height / scale_factor)
    bk(((skull_width_2 + ear_width) * 2) / scale_factor)
    ellipse(ear_width / scale_factor, ear_height / scale_factor)
    fd((skull_width_2 + ear_width) / scale_factor)
    rt(90)
    #"""
    goto(x, y)
    setheading(0)
    
hideturtle()
speed(0)
tracer(0, 0)
pu()
setup(550, 550)
line_pos = 200
for j in range(4):
    goto(-200, line_pos)
    for i in range(4):
        #face(0, 0, 0.02, 0.05, 2)
        face(0, 0, 0.05, 0.1, 2)
        #face(0, 0, 0.2, 0.2, 2)
        fd(120)
    line_pos -= 130
update()
done()


"""
from random import gauss

wert = 100
streuung = 5

neuer_wert = gauss(wert, streuung)
print(neuer_wert)
"""



