import math
from xturtle import *
from random import randint

def erstellshildiform():
    s=5              # seite
    hs=2.5              # halbe seite
    d=s*math.sqrt(2)  # diagonale
    schwanzlaenge=math.sqrt(s**2+hs**2)
    pu()
    goto(s+hs,0)
    pd()
    begin_poly()
    fd(hs)
    rt(45)
    fd(d)
    rt(45)
    fd(hs)
    lt(90+22.5)
    fd(schwanzlaenge)
    lt(90-22.5)
    fd(s)
    lt(90)
    fd(s)
    rt(90)
    fd(s)
    rt(90)
    fd(s)
    rt(45)
    fd(d)
    lt(45)
    fd(s)
    lt(45)
    fd(d)
    lt(45)
    fd(s)
    lt(45)
    fd(d)
    lt(45)
    fd(s)
    lt(45)
    fd(d)
    rt(45)
    fd(s)
    rt(90)
    fd(s)
    rt(90)
    fd(s)
    lt(90)
    fd(s)
    lt(90-22.5)
    fd(schwanzlaenge)
    lt(90+22.5)
    fd(hs)
    rt(45)
    fd(d)
    rt(45)
    fd(s)
    rt(45)
    fd(d)
    lt(45)
    fd(s)
    lt(90)
    fd(s)
    lt(90)
    fd(s)
    rt(90)
    fd(s)
    rt(90-22.5)
    fd(schwanzlaenge)
    lt(135)
    fd(schwanzlaenge)
    rt(90-22.5)
    fd(s)
    rt(90)
    fd(s)
    lt(90)
    fd(s)
    lt(90)
    fd(s)
    lt(45)
    fd(d)
    rt(45)
    fd(hs)
    end_poly()
    addshape("turtle",getpoly())

if __name__=="__main__":
    colors=["red","green","blue","yellow","purple","orange",]
    erstellshildiform()
    shape("turtle")
    clear()
    pu()
    speed(10)
    for i in range(15):
        if i/2.0==int(round(i/2.0))*1.0:
            a=15
        else:
            a=0
        goto(-200+a,150-20*i)
        for i2 in range(14):
            color(colors[randint(0,len(colors)-1)])
            setheading(0)
            pd()
            stamp()
            pu()
            setheading(90)
            fd(30)
    setheading(0)    
