#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 24 19:05:06 2017

@author: jared's account
"""

import matplotlib
import matplotlib.pyplot as plt
import numpy as np

def radwalk(step,stop):
    #length of one step
    l=step
    #length od total path R
    r=stop
    #initial coordinates
    x=0
    y=0
    xa=[]
    ya=[]
    ra=[]
    na=[]
    xa.append(x)
    ya.append(y)
    rad=np.sqrt(x**2+y**2)
    ra.append(rad)

    #number of steps
    n=0
    na.append(n)

    #degree to radian conversion
    rads=np.pi/180
    while rad < r:
        theta=np.random.randint(0,361)
        xn=x+l*np.cos(theta*rads)
        yn=y+l*np.sin(theta*rads)
        xa.append(xn)
        ya.append(yn)
        x=xn
        y=yn
        n+=1
        na.append(n)
        rad=np.sqrt(x**2+y**2)
        ra.append(rad)
        print(theta,xn,yn,rad,n)
        
        
    return(na,xa,ya,ra)

n,x,y,r=radwalk(1,20)
  