Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2018
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. #CS 171 by Shreedev Patel
  2. #Section 068
  3.  
  4. import sys
  5. global G = -1.622
  6. global A = 50
  7. global V = 0
  8. global F = 150
  9. global s = 0
  10. print('Welcome to Lunar Lander Game.')
  11. while True:
  12. try:
  13. y = input('Do uou want to play level 1? (yes/no) \n')
  14. y = str(y)
  15. if y == 'yes':
  16. print("")
  17. break
  18. if y == 'no':
  19. sys.exit()
  20. def ask_fuel (current_fuel):
  21. while True:
  22. try:
  23. f= input('Enter units of fuel to use:\n')
  24. f= int(f)
  25.  
  26. if (f<0) :
  27. print('Cannot use of negative fuel.')
  28. if current_fuel - f <= 0:
  29. print('Not enough fuel. Max fuel')
  30. else:
  31. break
  32. except ValueError:
  33. return f
  34. def play_level(name,G,fuel):
  35. print('Landing on the',name)
  36. print('Gravity is' ,G,'m/s^2')
  37. print('Initial Altitude',A,'meters')
  38. print('Initial Velocity',V,'m/s')
  39. print('Burning a unit of fuel causes 0.10m/s')
  40. while A>0:
  41. fuel = ask_fuel(current_fuel)
  42. F = F-fuel
  43. V=V+G+T*fuel
  44. A=A+V
  45. s=s+1
  46.  
  47. names=['Moon','Earth','Pluto','Neptune','Uranus','Saturn','Jupiter','Mars','Venus','Mercury','Sun']
  48. gravity=[-1.622,-9.81,-0.42,-14.07,-10.67,-11.08,-25.95,-3.77,-8.87,-3.59,-274.13]
  49. Fuel= [150,5000,1000,1000,1000,1000,1000,1000,1000,1000,50000]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement