# Arup Guha
# 3/29/2020
# A sample flag drawing for Pair Program #2

import turtle

def main():

    turtle.speed(0)

    # Top Left Region
    rect(-300, 165, 200, 150, "gold", 0)

    # Long parts of swords
    rect(-280, 35, 180, 10, "black", 36)
    rect(-130, 25, 180, 10, "black", 144)

    # Sword handles
    rect(-240, 30, 45, 10, "black", 126)
    rect(-170, 30, 45, 10, "black", 54)

    # Top right stripes
    for i in range(11):

        # Assign color for this stripe.
        clr = "gold"
        if i%2 == 1:
            clr ="black"

        # Default - full stripes.
        x = -300
        width = 600

        # Top stripes are shorter, update x and width.
        if i < 5:
            x = -100
            width = 400

        # This is the stripe we want.
        rect(x, 165-30*i, width, 30, clr, 0)
        

# Draws a rectangle with top left corner (x,y) with width of width pixels
# length of length pixels and fills it to be the color clr. The rectangle
# is rotated by angle degrees counter-clockwise from the positive x-axis.
def rect(x,y,width,length,clr,angle):

    # Get set up.
    turtle.penup()
    turtle.home()
    turtle.setpos(x, y)
    turtle.left(angle)
    turtle.fillcolor(clr)
    turtle.begin_fill()

    # Can write this by repeating these steps twice.
    for i in range(2):
        turtle.forward(width)
        turtle.right(90)
        turtle.forward(length)
        turtle.right(90)

    # Complete the fill.
    turtle.end_fill()

main()
