**TI83F*

Created by TI-Smartview CE 5.6.0.2092     ·
 ¦
GOLFTEMP  ¦
¤
PYCDfrisbeeGolfFinal.py from ti_draw import *
from random import *
from math import *
from time import *
from ti_system import *

def getFrisbees():
  type = randint(1,2)
  x = randint(-100,100)/10
  n = randint(-100,100)/10
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  a=float(eval(input("x = ")))
  if abs(a - x) <= 0.000001:
    print("correct")
    return 1
  else:
    print("sorry, x = ", x)
  return 0

def disp(val):
  if val > 0:
    return "+ " + p(val)
  return "- " + p(abs(val))

def p(x):
  if(floor((x+0.0001)*100)%10==0):
    x="{:.1f}".format(x)
  else:
    x="{:.2f}".format(x)
  return str(x)

def hoop():
  set_color(0,0,0)
  xc, yc = randint(100,180), randint(30,120)
  xl,yl=[],[]
  for i in range(1,66,6):
    xl.append(xc+10+15*cos(i/10))
    yl.append(yc-10+5*sin(i/10))
  xl.append(xl[0])
  yl.append(yl[0])
  draw_poly(xl,yl)
  
  for a in range(2,5):
    xl=[]
    yl=[]
    for i in range(31,66,6):
      xl.append(xc+10+15*cos(i/10))
      yl.append(yc-10+5*a*sin(i/10))
    draw_poly(xl,yl)
   
  fill_rect(xc+8,yc-48,5,20)
  return xc, yc

def person():
  set_color(0,0,0)
  draw_circle(10,50,10)
  fill_rect(8,15,2,25)
  draw_line(0,0,9,16)
  draw_line(9,16,18,0)
  draw_line(0,36,9,30)
  draw_line(9,30,20,36)

def frisbee(x,y):
  set_color(0,0,255)
  xl=[]
  yl=[]
  for i in range(0,66,6):
    xl.append(x+7*cos(i/10))
    yl.append(y+2*sin(i/10))
  fill_poly(xl,yl)

def throw(x,y,angle,v,time):
  x = 20+v*cos(radians(angle))*time
  y = -16*(time**2) + v*sin(radians(angle))*time + 36
  return x,y

def setAngle(angle):
  add = 5
  set_color(0,0,0)
  draw_line(20,36,30,36)
  while not escape():
    angle+=add
    if angle >80 or angle < 10:
      add=add*-1
    set_color(0,0,0)
    draw_line(20,36,25+10*cos(radians(angle)),36+10*sin(radians(angle)))
    sleep(.2)
    set_color(255,255,255)
    draw_line(20,36,25+10*cos(radians(angle)),36+10*sin(radians(angle)))
  set_color(0,0,0)
  draw_line(20,36,25+10*cos(radians(angle)),36+10*sin(radians(angle)))
  return angle

def setVelocity(v):
  add = 10
  while not escape():
    v += add
    set_color(0,0,0)
    fill_rect(30,0,10,30)
    set_color(255,0,255)
    fill_rect(30,0,10,30*v/130)
    sleep(.2)
    if v < 10 or v >= 130:
      add=add*-1
  return v

count = 1

#controls the num. of questions
for i in range(0):
  count += getFrisbees()
  sleep(2)
print("You earned",count,"frisbees")
sleep(2)

set_window(0,200,0,130)

for i in range(count):
  clear()
  person()
  x,y,time,angle,v = 20,36,0,randint(5,70),60
  xc, yc = hoop()
  angle = setAngle(angle)
  v = setVelocity(v)
  while y >=0 and x <= xc:
    x,y = throw(x,y,angle,v,time)
    frisbee(x,y)
    sleep(0.2)
    time+= 0.25
  sleep(2)áú