Advertisement
Guest User

Text Into Space

a guest
Aug 18th, 2014
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 16.13 KB | None | 0 0
  1. import sys
  2. import time
  3. import random
  4. import math
  5. from random import randint
  6.  
  7. global sucrate
  8. global stage
  9. global alist
  10. global stagen
  11. global sucratelist
  12. global namemis
  13. global anumber
  14. global achoose
  15. global cash
  16. global cost
  17. global destl
  18. global mistot
  19. global miswin
  20. global mislose
  21. global shiphis
  22. global loan
  23. global wagelist
  24. global classlist
  25. global joblist
  26. global achieve
  27. global orbit
  28. global dock
  29. global moon
  30. global mars
  31. global date
  32. global hiredate
  33. global alive
  34. alive = []
  35. hiredate = []
  36. orbit = 0
  37. dock = 0
  38. moon = 0
  39. mars = 0
  40. date = 1
  41. achieve = []
  42. joblist = []
  43. classlist = []
  44. wagelist = []
  45. destl = [5,7,10,20]
  46. cost = 0
  47. namemis = ''
  48. sucratelist = []
  49. stagen = 2
  50. alist = []
  51. dtag = []
  52. sucrate = 0
  53. stage = 1
  54. anumber = 0
  55. achoose = 0
  56. loan = 0
  57. cash = 8000+loan
  58. mistot = 0
  59. miswin = 0
  60. mislose = 0
  61. shiphis = []
  62. def Opening():
  63.     print('')
  64.     print('##################')
  65.     print('# Alexis DeSilva #')
  66.     print('#   Presents...  #')
  67.     print('#Text Into Space!#')
  68.     print('##################')
  69.     Menu()
  70. def Menu():
  71.     print('')
  72.     print('Day '+str(date))
  73.     print('')
  74.     print('1. Hire Astronauts')
  75.     print('2. Train Astronauts')
  76.     print('3. Work on Spaceship')
  77.     print('4. List of Crew')
  78.     print('5. Statistics')
  79.     print('6. Take Out Loan')
  80.     print('7. Exit Game')
  81.     print('')
  82.     choice = input('Input: ')
  83.     if choice == '1':
  84.         print('')
  85.         Astroname()
  86.     elif choice == '2':
  87.         print('')
  88.         Train()
  89.     elif choice == '3':
  90.         print('')
  91.         AddSuccess()
  92.     elif choice == '4':
  93.         print('')
  94.         AstroList()
  95.     elif choice == '5':
  96.         print('')
  97.         Stat()
  98.     elif choice == '6':
  99.         print('')
  100.         Loan()
  101.     elif choice == '7':
  102.         print('')
  103.         sys.exit
  104.     else:
  105.         print('INVALID BUTTON')
  106.         Menu()
  107. def Astroname():
  108.     global cash
  109.     global anumber
  110.     global wagelist
  111.     global joblist
  112.     global hiredate
  113.     jobclass = [0,1,2,3]
  114.     class0job = ['Janitor','Construction','Waiter','Cashier','Frycook']
  115.     class1job = ['Teacher','Accountant','Chef','Actor','Sports Player']
  116.     class2job = ['Pilot','Soldier','Engineer','Scientist']
  117.     chosenclass = 0
  118.     prefix = ['Al','Ald','An','Bar','Bart','Bur','Cal','Chad','Cor','Dan','Der','Dud','Ed','El','En','Er','Fer','Fred','Fil','Gene','Geof','Gus','Had','Hal','Han','Jeb','Joe','Jon','Kel','Kir','Ken','Lan','Lem','Lu','Mac','Mel','Mil','Ned','Neil','New','Ob','Or','Pat','Pil','Phil','Ray','Rib','Rod','Sam','Sean','Sid','Son','Tom','Thom','Wehr','Wil']
  119.     suffix =['ald','bal','bald','bart','bas','berry','bo','bree','cal','can','cas','cott','dan','do','don','dorf','drin','dun','emy','emone','ely','frey','frod','gan','gard','gee','hat','ing','kin','lie','lo','lorf','mal','man','mon','mund','nand','nie','oly','rey','rick','rim','rod','sby','sel','son','sted','ster','ton','top','trey','van','well','wig','win','wise','zer','zon','zor']
  120.     customname = ['Alexis','Kurt','Danny','Scott','Harv','Rick','Chris','Jebediah','Bob','Bill','Molly']
  121.  
  122.     customnot = randint(0,100)
  123.     if customnot <= 10:
  124.         name = random.choice(customname)
  125.     else:
  126.         name = random.choice(prefix) + random.choice(suffix)
  127.     if name in alist:
  128.             Astroname()
  129.     else:
  130.         print('')
  131.         print(str(name))
  132.         randomclass = randint(1,100)
  133.         if randomclass <= 33:
  134.             chosenclass = 0
  135.         elif randomclass <= 66:
  136.             chosenclass = 1
  137.         elif randomclass <= 99:
  138.             chosenclass = 2
  139.         else:
  140.             chosenclass = 3
  141.         if chosenclass == 0:
  142.             wagewant = randint(25,100)
  143.             job = random.choice(class0job)
  144.             print('Last Job: ' + str(job))
  145.             print('Wanted Wage: ' + str(wagewant))
  146.         elif chosenclass == 1:
  147.             wagewant = randint(75,175)
  148.             job = random.choice(class1job)
  149.             print('Last Job: ' + str(job))
  150.             print('Wanted Wage: ' + str(wagewant))
  151.         elif chosenclass == 2:
  152.             wagewant = randint(150,250)
  153.             job = random.choice(class2job)
  154.             print('Last Job: ' + str(job))
  155.             print('Wanted Wage: ' + str(wagewant))
  156.         else:
  157.             wagewant = randint(400,500)
  158.             job = 'Astronaut'
  159.             print('Last Job: ' + str(job))
  160.             print('Wanted Wage: ' + str(wagewant))
  161.         print('')
  162.         print('Do you want this astronaut? 1 = Yes, 0 = No')
  163.         keepno = input('Input: ')
  164.         if keepno == '1':
  165.             if cash >= 250:
  166.                 print('Astronaut Hired!')
  167.                 classlist.append(chosenclass)
  168.                 joblist.append(job)
  169.                 wagelist.append(wagewant)
  170.                 alist.append(name)
  171.                 alive.append(name)
  172.                 hiredate.append(date)
  173.                 dtag.append(0)
  174.                 achieve.append('Awards: Hired')
  175.                 cash -= 250
  176.                 anumber += 1
  177.                 Menu()
  178.             else:
  179.                 print('Could not afford astronaut!')
  180.                 Menu()
  181.         elif keepno == '0':
  182.             print('Astronaut Rejected...')
  183.             print('')
  184.             time.sleep(.5)
  185.             print('Look for more crew? 1 = Yes, 0 = No')
  186.             choice = input('Input: ')
  187.             if choice == '1':
  188.                 Astroname()
  189.             elif choice == '0':
  190.                 Menu()
  191.             else:
  192.                 print('INVALID BUTTON: RETURNING TO MENU')
  193.                 Menu()
  194.         else:
  195.             print('INVALID BUTTON: ASTRONAUT REJECTED')
  196.             Astroname()
  197.     Menu()
  198. def AddSuccess():
  199.     global date
  200.     global stage
  201.     global stagen
  202.     global sucrate
  203.     global stagelist
  204.     global sucratelist
  205.     global namemis
  206.     global cash
  207.     global cost
  208.     global destl
  209.     if stage == 1:
  210.         if sucrate == 0:
  211.             namemis = input('Name Your Mission: ')
  212.             print('Where will you go?')
  213.             print('5.  Orbit')
  214.             print('7.  Docking')
  215.             print('10. Moon')
  216.             print('20. Mars')
  217.             dest = int(input('Destination: '))
  218.             if dest in destl:
  219.                 stagen = dest+1
  220.             else:
  221.                 print('')
  222.                 print('Invalid Number')
  223.                 print('')
  224.                 AddSuccess()
  225.             print('')
  226.         else:
  227.             print('')
  228.     else:
  229.         print('')
  230.     print(str(namemis) + ': ' + str(stagen-1) + ' stages')
  231.     print('')
  232.     if stage == stagen:
  233.         print('Mission Designed!')
  234.     else:
  235.         print('Stage ' + str(stage) + ' Success Rate: ' + str(sucrate))
  236.         print('Current Funds: ' + str(cash))
  237.     print('1. Round of Research')
  238.     if stagen >= stage + 1:
  239.         print('2. Next Stage')
  240.     else:
  241.         print('2. LAUNCH')
  242.     print('3. Return to Menu')
  243.     choice = input('Input: ')
  244.     if choice == '1':
  245.         if stagen <= stage:
  246.             print('CANNOT RESEARCH')
  247.             AddSuccess()
  248.         else:
  249.             money = randint(95,150)
  250.             wage = sum(wagelist)
  251.             costtot = money+(wage)
  252.             if cash >= costtot:
  253.                 cash -= costtot
  254.                 sucrate += randint(5,13)
  255.                 cost += money
  256.                 date += randint(3,7)
  257.                 if sucrate >= 100:
  258.                     sucrate = 100
  259.                     print('Reached Max Success!')
  260.                 else:
  261.                     print('Success Rate: ' + str(sucrate))
  262.             else:
  263.                 print('Cannot Afford This!')
  264.     elif choice == '2':
  265.             if stagen >= stage + 1:
  266.                 stage += 1
  267.                 sucratelist.append(sucrate)
  268.                 sucrate = 0
  269.                 date += randint(1,3)
  270.                 print('Next Stage!')
  271.             else:
  272.                 AstroChoose()
  273.     elif choice == '3':
  274.         Menu()
  275.     else:
  276.             print('INVALID BUTTON')
  277.     AddSuccess()
  278. def AstroList():
  279.     print('Alive Roster:')
  280.     print('')
  281.     print("\n".join([x for x in alive]))
  282.     print('')
  283.     print('K.I.A:')
  284.     print('')
  285.     print("\n".join([x for x in alist if x not in alive]))
  286.     print('')
  287.     input('Press ENTER to leave')
  288.     Menu()
  289. def AstroChoose():
  290.     global achoose
  291.     alive2 = [item for item in alive]
  292.     print('')
  293.     print('Choose an Astronaut!')
  294.     print("\n".join([x for x in alive2]))
  295.     achoose = input('Astronaut: ')
  296.     while achoose in alist:
  297.         if achoose not in alive:
  298.             print(str(achoose) + ' has died before!')
  299.             Menu()
  300.         else:
  301.             print('')
  302.             print(str(achoose) + ' has been chosen to fly ' + str(namemis) + '!')
  303.             print('')
  304.             LaunchCheck()
  305.     else:
  306.         print('Not Valid Astronaut!')
  307.         Menu()
  308. def LaunchCheck():
  309.     global mistot
  310.     global miswin
  311.     global mislose
  312.     global dtag
  313.     global achoose
  314.     global stagen
  315.     global sucrate
  316.     global stage
  317.     global sucratelist
  318.     global wagelist
  319.     global namemis
  320.     global cash
  321.     global cost
  322.     global anumber
  323.     global shiphis
  324.     global loan
  325.     global orbit
  326.     global dock
  327.     global moon
  328.     global mars
  329.     global date
  330.     global alive
  331.     date += randint(7,21)
  332.     inprogstage = 2
  333.     succ = 0
  334.     mistot += 1
  335.     while inprogstage <= stagen:
  336.         findlist = alist.index(achoose)
  337.         modifyfind = classlist[findlist]
  338.         if modifyfind == 0:
  339.             modify = -5
  340.         elif modifyfind == 1:
  341.             modify = 0
  342.         elif modifyfind == 2:
  343.             modify = 5
  344.         else:
  345.             modify = 10
  346.         progstagesuc = (randint(0,99)+modify)
  347.         if progstagesuc >= sucratelist[succ]:
  348.             time.sleep(5)
  349.             mislose += 1
  350.             print('Mission Failure')
  351.             wagelist.pop(findlist)
  352.             shiphis.append(str(namemis) + ' - Stages: ' + str(stagen-1) + ' - Pilot: ' + str(achoose) + ' - Failure')
  353.             time.sleep(2)
  354.             print('')
  355.             cash -= math.floor(100*((randint(5,10)/10)+1))
  356.             anumber -= 1
  357.             print(str(achoose) + ' died on stage ' + str(inprogstage-2) + ' at ' + str(sucratelist[succ]) + ' percent odds...')
  358.             print('')
  359.             input('Press ENTER to do a new Mission')
  360.             dtag[findlist]=date
  361.             alive.remove(achoose)
  362.             namemis = ''
  363.             sucratelist = []
  364.             stagen = randint(4,8)
  365.             sucrate = 0
  366.             stage = 1
  367.             Menu()
  368.         else:
  369.             succ += 1
  370.             inprogstage += 1
  371.     time.sleep(5)
  372.     miswin += 1
  373.     print('Mission Success!')
  374.     shiphis.append(str(namemis) + ' - Stages: ' + str(stagen-1) + ' - Pilot: ' + str(achoose) + ' - Success')
  375.     time.sleep(2)
  376.     if stagen-1 != 7:
  377.         if stagen-1 == 5:
  378.             print(str(achoose)+' went to orbit!')
  379.             if orbit == 0:
  380.                 orbit += 1
  381.                 findlist = alist.index(achoose)
  382.                 achieve[findlist]=str(achieve[findlist] + ', First to Orbit')
  383.             else:
  384.                 orbit += 0
  385.         elif stagen-1 == 10:
  386.             print(str(achoose)+' went to the Moon!')
  387.             if moon == 0:
  388.                 moon += 1
  389.                 findlist = alist.index(achoose)
  390.                 achieve[findlist]=str(achieve[findlist] + ', First to the Moon')
  391.             else:
  392.                 moon += 0
  393.         else:
  394.             print(str(achoose)+' went to Mars!')
  395.             if mars == 0:
  396.                 mars += 1
  397.                 findlist = alist.index(achoose)
  398.                 achieve[findlist]=str(achieve[findlist] + ', First to Mars')
  399.             else:
  400.                 mars += 0
  401.     else:
  402.         print(str(achoose)+' docked to a space station!')
  403.         if dock == 0:
  404.             dock += 1
  405.             findlist = alist.index(achoose)
  406.             achieve[findlist]=str(achieve[findlist] + ', First to Dock')
  407.         else:
  408.             dock += 0
  409.     print('')
  410.     input('Press ENTER to do a new Mission')
  411.     cash += math.ceil((cost*((stagen/10)+1.2)-(math.floor(loan*.2))))
  412.     loan -= (math.floor(loan*.20))
  413.     cost = 0
  414.     namemis = ''
  415.     sucratelist = []
  416.     sucrate = 0
  417.     stage = 1
  418.     Menu()
  419. def Stat():
  420.     global cash
  421.     global mistot
  422.     global miswin
  423.     global mislose
  424.     print('')
  425.     print('Cash: ' + str(cash))
  426.     print('')
  427.     print('You have flown ' + str(mistot) + ' missions:')
  428.     print(str(miswin) + ' were successful...')
  429.     print(str(mislose) + ' are tragedies...')
  430.     print('')
  431.     print('1. Ship History')
  432.     print('2. View Contracts')
  433.     print('3. View Astronaut Records')
  434.     print('4. Exit to Menu')
  435.     choice = input('Input: ')
  436.     if choice == '1':
  437.         ShipShow()
  438.     elif choice == '2':
  439.         Contracts()
  440.     elif choice == '3':
  441.         indivrec()
  442.     elif choice == '4':
  443.         Menu()
  444.     else:
  445.         print('INVALID BUTTON')
  446.         Stat()
  447. def ShipShow():
  448.     print('Ships:')
  449.     print('')
  450.     print("\n".join([x for x in shiphis]))
  451.     print('')
  452.     input('Press ENTER to leave')
  453.     Stat()
  454. def Loan():
  455.     global loan
  456.     global cash
  457.     loanimm = 0
  458.     print('')
  459.     print('How much do you want to loan (in thousands)?')
  460.     loanimm = (int(input('Input: '))*1000)
  461.     loan += loanimm
  462.     cash += loanimm
  463.     Menu()
  464. def Contracts():
  465.     print('')
  466.     a = anumber-1
  467.     while a >= 0:
  468.         print(str(alist[a])+' - Class '+str(classlist[a])+' - Former Job: '+str(joblist[a])+' - Wage: '+str(wagelist[a]))
  469.         a -= 1
  470.     print('')
  471.     input('Press RETURN to return to Statistics!')
  472.     Stat()
  473. def Train():
  474.     global cash
  475.     global classlist
  476.     global wagelist
  477.     global date
  478.     print('')
  479.     print('Choose Astronaut')
  480.     print('')
  481.     a = anumber-1
  482.     while a >= 0:
  483.         print(str(alist[a])+' - Class '+str(classlist[a])+' - Former Job: '+str(joblist[a])+' - Wage: '+str(wagelist[a]))
  484.         a -= 1
  485.     atchoose = input('Astronaut: ')
  486.     while atchoose in alist:
  487.         if atchoose not in alive:
  488.             print(str(atchoose) + ' has died before!')
  489.             Menu()
  490.         else:
  491.             print('')
  492.             findlist = alist.index(atchoose)
  493.             atclass = classlist[findlist]
  494.             print('Cost: ' + str((int(atclass)+1)*1000))
  495.             print('1. Train')
  496.             print('2. Cancel')
  497.             traino = input('Input ')
  498.             if traino == '1':
  499.                 if int(classlist[findlist]) >= 3:
  500.                     print('')
  501.                     print('Cannot Train: Max Class')
  502.                     Menu()
  503.                 else:
  504.                     if cash >= int((int(atclass)+1)*1000):
  505.                         classlist[findlist]=(classlist[findlist])+1
  506.                         wagelist[findlist] += 75
  507.                         cash -= int((int(atclass)+1)*1000)
  508.                         print('')
  509.                         date += randint(7,10)
  510.                         print('Astronaut Trained!')
  511.                         Menu()
  512.                     else:
  513.                         print('Not enough money!')
  514.                         Menu()
  515.             else:
  516.                 Menu()
  517.     else:
  518.         print('Not Valid Astronaut!')
  519.         Train()
  520. def indivrec():
  521.     print('')
  522.     print('Choose Astronaut')
  523.     print('')
  524.     print("\n".join([x for x in alist]))
  525.     print('')
  526.     rchoose = input('Astronaut: ')
  527.     while rchoose in alist:
  528.         print('|~~~~~~~~~~')
  529.         print('|Record of '+str(rchoose)+':')
  530.         print('|~~~~~~~~~~')
  531.         findlist = alist.index(rchoose)
  532.         print('|Hired on Day '+str(hiredate[findlist]))
  533.         if dtag[findlist]<=0:
  534.             print('|Status: Active')
  535.             print('|Wage: '+str(wagelist[findlist]))
  536.             print('|Class: '+str(classlist[findlist]))
  537.         else:
  538.             print('|Status: K.I.A. on Day: '+ str(dtag[findlist]))
  539.             print('|Wage: N/A')
  540.             print('|Was Class: '+str(classlist[findlist]))
  541.         print('|Former Job: '+str(joblist[findlist]))
  542.         print('|'+str(achieve[findlist]))
  543.         print('|~~~~~~~~~')
  544.         input('Return to Menu')
  545.         Menu()
  546.     else:
  547.         print('Not Valid Astronaut!')
  548.         Menu()
  549. Opening()
  550. input('')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement