#  Simple in-line (no module) python random 
#  walk program in 2D.
#  Performs and plots up to 5 random walks.
#  Walkers start at the origin: (x,y) = (0,0)
#  At each step, walker moves only one unit in 
#  a random direction : <up, down, left,right> 
import sys, random
import numpy as np
import matplotlib.pyplot as plt
random.seed(None)        # Seed generator, None => system clock

def rand_angle(): 
    """ Function locates random point on the unit circle """
#########################################################################
#   YOUR CODE GOES HERE:
#     Complete the function to return point (xdelta,ydelta)
##########################################################################
    return xdelta, ydelta

def random_walk2d(steps):
    """ Performs 2D random walk with number of steps = steps 
        At each step, walker moves in instep of length one """
###########################################################################
#    YOUR CODE GOES HERE: 
#      Complete this function to perform random walk in each axis 
#      (xwalk, ywalk arrays) using rand_angle to get lengths of each step.
#      Then return xwalk,ywalk arrays
###########################################################################
    return xwalk,ywalk
#
#   Enter number of walks to plot and check entered value
#
###########################################################################
#    YOUR CODE GOES HERE: 
#      Allow user to enter number of walks (num_walks) btween 1 and 5.
#      Print message and exit if number entered is not in range
###########################################################################
#
#  Sets number of steps in each random walk    
num_steps = 1000 
#  Allows each walk to use a different color/line type on plot 
line_type = ['r-','b-','k-','g-','m-']
#
#  Perform random walk and plot result for each walk
#   
plt.clf     #  Clear the graph figure
#############################################################################
#  YOUR CODE GOES HERE:
#      Execute each walk and plot on graph. Each walk should be in different 
#      color and have different label in legend.
#      Mark the end position for each walk with a large black star symbol ('k*',ms=16)
################################################################################ 
#
#  Create bold lines on each axis through origin
plt.axhline(0, color='black', lw=1)  
plt.axvline(0, color='black', lw=1) 
#  Set plot title , legend, and grid 
plt.title('Two-dimensional random walks(' + str(num_walks) + ')' )
plt.legend(loc="upper left")
plt.grid(True)
plt.show() 


