#Case-Study №1
#Developers: Manko Andrey (20%)
#            Borodkin Denis (20%)
#            Mauter Akeksandr (60%)
import turtle
import math

def square(x, y, a, color):
    turtle.up()
    turtle.setposition(x, y)
    turtle.down()
    turtle.color(color)
    turtle.begin_fill()
    turtle.forward(a)
    turtle.right(90)
    turtle.forward(a)
    turtle.right(90)
    turtle.forward(a)
    turtle.right(90)
    turtle.forward(a)
    turtle.right(90)
    turtle.end_fill()

def parallelogram(x, y, a, color):

    turtle.up()
    turtle.setposition(x, y)
    turtle.down()
    turtle.color(color)
    turtle.begin_fill()
    turtle.forward(a)
    turtle.right(60)
    turtle.forward(a)
    turtle.right(120)
    turtle.forward(a)
    turtle.right(60)
    turtle.forward(a)
    turtle.up()
    turtle.end_fill()


def triangle(x, y, a, color):
    turtle.up()
    turtle.setposition(x, y)
    turtle.down()
    turtle.color(color)
    turtle.begin_fill()
    turtle.forward(a)
    turtle.right(90)
    turtle.forward(a)
    turtle.right(135)
    turtle.forward(math.sqrt(a**2+a**2))
    turtle.end_fill()



def main():
    parallelogram(-585, 330, 25, 'red')
    turtle.right(120)
    square(-560, 305, 25, 'orange')
    turtle.right(90)
    triangle(-563, 295, 60, 'green')
    turtle.right(-45)
    triangle(-623, 172, 60, 'yellow')
    turtle.left(45)
    triangle(-570, 220, 50, 'blue')
    turtle.right(225)
    triangle(-537, 170, 30, 'purple')
    turtle.right(360)
    triangle(-560, 255, 30, 'gray')
    turtle.right(90)
    parallelogram(-450, 280, 25, 'green')
    turtle.right(30)
    triangle(-432, 235, 20, 'pink')
    turtle.left(45)
    triangle(-435, 255, 20, 'blue')
    turtle.left(180)
    square(-368, 257, 30, 'orange')
    turtle.left(45)
    triangle(-366, 253, 60, 'red')
    turtle.right(45)
    triangle(-425, 320, 60, 'red')
    turtle.left(180)
    triangle(-360, 287, 40, 'black')
    turtle.right(90)
    parallelogram(-250, 270, 55, 'green')
    turtle.right(75)
    triangle(400, -105, 40, 'black')
    turtle.left(180)
    triangle(400, -105, 55, 'blue')
    turtle.left(180)
    triangle(400, -110, 75, 'yellow')
    turtle.left(45)
    triangle(455, -275, 75, 'red')
    turtle.left(45)
    square(400, -225, 40, 'orange')
    turtle.left(180)
    turtle.left(180)
    triangle(373, -257, 40, 'grey')
    turtle.left(60)
    parallelogram(492, -295, 40, 'grey')
    turtle.left(90)



if __name__ == '__main__':
    main()
