hfreni

New Generator

May 16th, 2015
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.95 KB | None | 0 0
  1. import json
  2. import urllib2
  3. import math
  4.  
  5. METRES_PER_INCH = 0.0254
  6. LAUNCH_ANGLE = input('Enter the Launch Angle in Degrees: ')
  7. LAUNCH_HEIGHT = input('Enter your Launch Height in Inches: ')
  8. INCREMENT = input('Enter a Distance Increment in Inches: ')
  9. FIELD_SIZE = 140.5
  10. GOAL_X = 4.0941
  11. GOAL_Y = 139.9059
  12.  
  13. i = 0
  14. j = 0
  15. l = ''
  16.  
  17. for length in xrange(0, 195, INCREMENT):
  18.     y = length + GOAL_Y
  19.     data = json.load(urllib2.urlopen('http://vex.us.nallen.me/exec/extras/nbn_shooting?x=' + str(GOAL_X*METRES_PER_INCH) + '&y=' + str(y*METRES_PER_INCH) + '&z='+ str(LAUNCH_HEIGHT * METRES_PER_INCH) +'&angle='+ str(LAUNCH_ANGLE)))
  20.     basic = '   {' + str(round(data['incident'],2)) + ',' + str(round(data['speed'],2)) + ',' + str(length) + '}'
  21.  
  22.     if data['speed'] == -1:
  23.         i = i+1
  24.     else:
  25.         if data['incident'] < 45:
  26.             j = j+1
  27.         else:
  28.             l = l + basic + ',\n'
  29. print 'float fiedlPOSLaunch[' + str(round(195/INCREMENT) - i + 1) + '] [3] = {'
  30. print l[:-2]
  31. print '};'
Advertisement
Add Comment
Please, Sign In to add comment