# Lab 5 - Exercise 2 - Problem (Exploration Exercise) 2
#
# Create a Python program which draws the following shapes (circle, square and steps) using the built-in Turtle module functions.
#
# Anne Lavergne
# February 2016

import turtle as t   # or import turtle

# draws a circle
def filledCircle(aTurtle, aPenSize, aRadius, aLineColour, aFilledColour):
    """draw a circle
       do not return anything
       
       to call the function: circle(<radius value>, <colour value>)
    """
    aTurtle.pensize(aPenSize)
    aTurtle.pencolor(aLineColour)
    aTurtle.fillcolor(aFilledColour)
    aTurtle.begin_fill()
    aTurtle.circle(aRadius)
    aTurtle.end_fill()
    return
    

# ideas for functions:
def square(aTurtle, aPenSize, anAngle, aLength, aColour):
    """ draw a rectangle
        do not return anything

        to call the function:
        square(<penSize value>, <angle value>, <length value>, <colour value>)
    """
    aTurtle.pensize(aPenSize)
    aTurtle.pencolor(aColour)
    aTurtle.left(anAngle)
    for section in range(4):
        aTurtle.forward(aLength)
        aTurtle.right(anAngle)
    return


# ideas for functions:
def steps(aTurtle, aPenSize, anAngle, aLength1, aLength2, aColour, numberOfSteps):
    """ draw x number of steps
        do not return anything
    
        to call the function:
        steps(<penSize value>, <angle value>, <length 1 value>, <length 2 value>, <colour value>, <numberOfSteps value>, )
    """
    aTurtle.pensize(aPenSize)
    aTurtle.color(aColour)
    for section in range(numberOfSteps):
        if section % 2 ==  0: # When turn left for the even steps
            aTurtle.forward(aLength1)
            aTurtle.left(anAngle)             
        else:                 # When turn right for the odd steps
            aTurtle.forward(aLength2)
            aTurtle.right(anAngle)
    aTurtle.right(anAngle)    
    return


# MAIN - Top Level

t.setup(width=1200, height=600)

# penup + move forward
t.penup( )
t.forward(-200)
t.pendown()
# pendown + circles
filledCircle(t, 5, 70, "blue", "orange")        # draw a red circle

# penup + move forward
t.penup( )
t.forward(150)
t.pendown()

# yellow square
square(t, 4, 90, 120, "yellow")

# penup + move forward
t.penup( )
t.right(90)
t.forward(200)
t.pendown()

# red steps
steps(t, 4, 90, 150, 100, "red", 3)