Tested mission code. I was too lazy to write it better but it works.
Bugs - improving skill is timesing not adding.
mission stages need to be in list, utilising if oib is in vostok1 etc etc.
Im going to be a good lil programmer and make a flow chart for mission res tomorrow. It will aid in my thinking.
import random
import time
##types of activity##
#Launch
#Orbital Insertion Burn
#Earth Orbital Activities
#Orbital Docking
#Equipment power-up
#LEM descent
#LEM testing thrusters
#Orbital EVA
#Duration A
#Duration B
#Duration C
#Duration D
#Duration E
#Duration F
#Trans-Lunar injection
#Mid-Course Correction Burn
#Lunar Photography
#Lunar Orbital Activities
#Re-entry
#Recovery
##type end##
##generation##
c = random.randint(0, 10)
l = random.randint(0, 5)
e = random.randint(0, 5)
d = random.randint(0, 5)
en = random.randint(0, 5)
m = random.randint(0, 100)
mor = 100
start = ''
print 'Hello, what is your name?'
name = raw_input('> ')
time.sleep(1)
print 'Your name is ' + name + "."
while True:
time.sleep(2)
print 'Would you like to be a Cosmonaut or Astronaut?'
nationchoice = raw_input()
if nationchoice == 'Cosmonaut' or nationchoice == "cosmonaut":
break
elif nationchoice == 'Astronaut' or nationchoice == "astronaut":
break
else:
'Choose Cosmonaut or Astronaut please.'
cosmonautmoney = 75
astronautmoney = 100
cosmonautstageone = 'Vostok'
astronautstageone = 'Mercury'
##BEGINNING OF ROSTERS##
##mercury 7##
Shirra = [4, 2 , 2, 2, 2, 100]
Glenn = [4, 2, 2, 0, 2, 100]
Grissom = [6, 2, 2, 2, 2, 100]
Cooper = [4, 2, 2, 2, 6, 100]
Shepard = [2, 2 ,2 ,2 ,4 , 100]
Slayton = [8, 2, 2, 0, 2, 100]
Carpenter = [1, 0, 1, 0, 2, 100]
if nationchoice == 'Astronaut':
name = [name, c, e, l, d, en, mor]
Astronauts = [Shirra, Glenn, Grissom, Cooper, Shepard, Slayton, Carpenter] + [name]
##Vostok crew##
Gagarin = ['Gagarin', 6, 2, 2, 2, 2, 100]
Titov = ['Titov', 4, 2, 2, 2, 2, 100]
Nikolayev = ['Nikolayev', 4, 2, 2, 2, 6, 100]
Popovich = ['Popovich', 4, 2, 2, 4, 6, 100]
Bykovsky = ['Bykovsky', 4, 4, 4, 4, 6, 100]
Tereshkova = ['Tereskova', 0, 2, 2, 0, 2, 100]
if nationchoice == 'Cosmonaut':
name = [name, c, e, l, d, en, mor]
Cosmonaut = [Gagarin, Titov, Nikolayev, Popovich, Bykovsky, Tereshkova] + [name]
##END OF ROSTERS##
intro = 1
if nationchoice == 'Cosmonaut':
campaign = 1
date = 1961
qt = 2
print 'You are a Cosmonaut.'
if nationchoice == 'Astronaut':
campaign = 2
date = 1957
qt = 1
print 'You are an Astronaut.'
time.sleep(1)
print 'The date is ' + str(date)
time.sleep(1)
print 'Your goal is to have a successful career in the space program, good luck!'
time.sleep(2)
vis = 5
intro = 0
##classes##
class Mission:
def __init__(self, program, number, year, quarter, OIB, EVA, manned):
self.program = program
self.number = number
self.year = year
self.quarter = quarter
self.OIB = OIB
self.EVA = EVA
self.manned = manned
class Rocket:
def __init__(self, safety, payload):
self.safety = safety
self.payload = payload
redstone = Rocket(60, 800)
aseries = Rocket(60, 900)
sputnik4 = Mission('Sputnik', '4', 1960, 2, 'True', 'False', 'False')
sputnik4b = Mission('Sputnik', '4b', 1960, 3, 'True', 'False', 'False')
sputnik5 = Mission('Sputnik', '5', 1960, 3, 'True', 'False', 'False')
sputnik6 = Mission('Sputnik', '6', 1960, 4, 'True', 'False', 'False')
sputnik7 = Mission('Sputnik', '7', 1960, 4, 'True', 'False', 'False')
sputnik9 = Mission('Sputnik', '9', 1961, 1, 'True', 'False', 'False')
sputnik10 = Mission('Sputnik', '10', 1961, 1, 'True', 'False', 'False')
vostok1 = Mission('Vostok', '1', 1961, 2, 'True', 'False', 'True')
vostok2 = Mission('Vostok', '2', 1961, 3, 'True', 'False', 'True')
vostok3 = Mission('Vostok', '3', 1962, 3, 'True', 'False', 'True')
vostok4 = Mission('Vostok', '4', 1962, 3, 'True', 'False', 'True')
vostok5 = Mission('Vostok', '5', 1963, 2, 'True', 'False', 'True')
vostok6 = Mission('Vostok', '6', 1963, 2, 'True', 'False', 'True')
s4year = sputnik4.year
s4qt = sputnik4.quarter
s4byear = sputnik4b.year
s4bqt = sputnik4b.quarter
s5year = sputnik5.year
s5qt = sputnik5.quarter
s6year = sputnik6.year
s6qt = sputnik6.quarter
s7year = sputnik7.year
s7qt = sputnik7.quarter
s9year = sputnik9.year
s9qt = sputnik9.quarter
s10year = sputnik10.year
s10qt = sputnik10.quarter
v1year = vostok1.year
v1quarter = vostok1.quarter
v1oib = vostok1.OIB
v1eva = vostok1.EVA
vimanned = vostok1.manned
##menu##
choice = '0'
name = 'alive'
while name == 'alive':
while choice != 5:
print 'The date is ' + str(date) + ', Quarter ' + str(qt)
print 'What would you like to do?\n'
time.sleep(2)
print 'You can:\n1.REST\n2.PRACTICE\n3.SOCIALISE\n4.VIEW SKILLS\n10.NEXT TURN'
time.sleep(1)
print 'Enter your choice.'
choice = raw_input()
##viewskills##
if choice == '1':
print 'Your skills are\n'
print 'Cap: ' + str(c)
print 'LEM: ' + str(l)
print 'EVA: ' + str(e)
print 'Doc: ' + str(d)
print 'End: ' + str(en)
print 'Mor: ' + str(m)
raw_input('Press ENTER to close')
##rest##
elif choice == '1':
mor = random.randint(0, 5)
print 'moral increased by ' + str(increase) + ' to ' + str(m)
time.sleep(2)
choice = 5
##Socialise##
elif choice == '3':
vis = random.randint(0, 4)
print 'You go to a local party, increasing your visibility to the elite by ' + str(increase) + ' making it ' + str(vis)
time.sleep(2)
choice = 5
##practice##
elif choice == '2':
choice = '5'
pchoice = ''
while pchoice != 'o':
print 'What would you like to practice?'
print '[C]apsule\n[L]EM\n[E]VA\n[D]ocking\nE[n]durance\nN[o]ne'
pchoice = raw_input()
if pchoice == 'c':
c = c + str(random.randint(0, 4))
print 'your practice increased your Capsule skill to ' + str(c)
pchoice = 'o'
choice = 5
if pchoice == 'l':
l = l + str(random.randint(0, 4))
print 'your practice increased your LEM skill to ' + str(l)
pchoice = 'o'
choice = 5
if pchoice == 'e':
e = e + str(random.randint(0, 4))
print 'your practice increased your EVA skill to ' + str(e)
pchoice = 'o'
choice = 5
if pchoice == 'd':
d = d + str(random.randint(0, 4))
print 'your practice increased your Docking skill to ' + str(d)
pchoice = 'o'
choice = 5
if pchoice == 'n':
n = c + str(random.randint(0, 4))
print 'your practice increased your Endurance skill to ' + str(n)
pchoice = 'o'
choice = 5
time.sleep(1)
print 'Your skills are\n'
print 'Cap: ' + str(c)
print 'LEM: ' + str(l)
print 'EVA: ' + str(e)
print 'Doc: ' + str(d)
print 'End: ' + str(en)
print 'Mor: ' + str(m)
raw_input('Press ENTER to close')
vostok1status = 'off'
##programstatus##
if date == v1year:
if qt == v1quarter:
vostok1status = 'go'
vostok1crewstatus = 'empty'
##crew selection##
if vostok1status == 'go':
vostok1crew = Cosmonaut[0][1]
for cosmonaut in Cosmonaut:
if cosmonaut[1] > vostok1crew:
vostok1crew = cosmonaut[1]
print 'Vostok crew is chosen as ' + str(vostok1crew)
##end##
if v1year == date:
if v1quarter == qt:
go = 'go'
while go == 'go':
print 'Vostok 1 launching'
if random.randint(0, 100) > (aseries.safety + vostok1crew):
print 'Launch fails'
if random.randint(0, 100) > 50:
print 'Catastrophic failure!! rocket explodes killing the crew!'
vostok1crew = 'dead'
go == 'failed'
print 'Launch stage successful'
if v1oib == True:
print 'Performing orbital insertion burn'
if random.randint(0, 100) > (aseries.safety + vostok1crew):
print 'orbital insertion fails, running alternate plan'
if random.randint(0, 100) > 50:
print 'Catastrophic failure! capsule is stranded in space'
vostok1crew = 'dead'
go == 'failed'
print 'orbital insertion successful'
print 'Performing de-orbit burn'
if random.randint(0, 100) > (aseries.safety + vostok1crew):
'De-orbit burn fails!'
if random.randint(0, 100) > 50:
print 'Catastrophic failure! capsule burns up in atmosphere!'
vostok1crew = 'dead'
go = 'failure'
print 'De-orbit burn successful'
print 'Performing re-entry'
if random.randint(0, 100) > (aseries.safety + vostok1crew):
print 'Re-entry vehicle veers off course...'
if random.randint(0, 100) > 50:
print 'Craft burns up on re entry! everyone died'
vostok1crew = 'dead'
go = 'failed'
print 'Re-entry successful!'
go = 'complete'
##end turn calc##
if qt == 4:
date = date +1
qt = 0
qt = qt + 1
choice = ''
##working - next to do - rework astronaut selection, do space program progression##
##revise skill increase to include the incriment in which it increased by##