# Elizabeth Briley
# 6/6/2016
# Solution to SI@UCF Turtle Day #3 Assignment

import turtle

#Part A

#Write a program that prints out a spiraling triangle.
#Prompt the user to enter the maximum length of the side of the triangle to draw.
#Each side length should be 10 pixels longer than the previous side.

tri = turtle.Turtle();

tri.pu();
tri.setposition(100, 100);
tri.pd();


inp =int(input("What is the maximum side length of your triangle?"));

i = inp%10;

# Key here is that we always turn by 120 and increment our side by 10.
while(i<=inp):
    tri.forward(i);
    tri.left(120);
    i+=10;


#Part B

#Write a program that prints nested squares
#Prompt the user to enter the number of squares, and draw the corresponding squares

squares = turtle.Turtle();

squares.pu();
squares.setposition(-100, -100);
squares.pd();


inp = int(input("How many squares would you like me to draw?"));
sidelength=5;

# i is keeping track of which square we are on.
for i in range(inp):

    # Draw the square
    for k in range(4):
        squares.forward(sidelength);
        squares.left(90);

    # Move without drawing to where the next square will start.    
    squares.pu();
    squares.right(90);
    squares.forward(5);
    squares.left(90);
    squares.backward(5);
    squares.pd();
    sidelength+=10;

turtle.done();
