'''lecture_11_random_walk.py
Have 3 turtles walk around randomly with their unique properties
Oliver W. Layton
CS 151: Computational Thinking: Visual Media
Spring 2021
TODO: Move customizing a turtle to a customize_turtle function
TODO: Move screen creation to a make_screen function
'''
import turtle
import random


def make_turtle(theColor='blue'):
    turt = turtle.Turtle()
    turt.shape('turtle')
    turt.color(theColor)
    return turt

'''Screen'''
# call Screen's constructor to make a new pop-up window/canvas
theScreen = turtle.Screen()

# Control how big we want it
w = 800
h = 800
theScreen.setup(width=w, height=h)

# Make turtles (turtle shape) and customize their properties (e.g. color)
turt1 = make_turtle(theColor='pink')
turt2 = make_turtle(theColor='green')
turt3 = make_turtle()
# turt1 = turtle.Turtle()
# turt2 = turtle.Turtle()
# turt3 = turtle.Turtle()

# turt1.shape('turtle')
# turt2.shape('turtle')
# turt3.shape('turtle')

# turt1.color('pink')
# turt2.color('green')
# turt3.color('blue')

# Make turtles move randomly 1000 times.
# Change their direction (randomly) every 10 movements
# Move them forward a random amount (1-3 pixels)
for i in range(1000):
    # use mod % operator
    if i % 10 == 0:
        turt1.setheading(360*random.random())
        turt2.setheading(360*random.random())
        turt3.setheading(360*random.random())
    turt1.forward(random.randint(1, 3))
    turt2.forward(random.randint(1, 3))
    turt3.forward(random.randint(1, 3))

theScreen.exitonclick()
