Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- all_countries =['Indonesia','Thailand','Vietnam','Singapore','Philippines','Malaysia','Myanmar','Cambodia','Laos','Brunei']
- rockets=0
- alive_countries= {'count1' : 'Indonesia','count2': 'Thailand','count3':'Vietnam','count4': 'Singapore','count5': 'Philippines','count6': 'Malaysia','count7': 'Myanmar','count8': 'Cambodia','count9': 'Laos','count10': 'Brunei'}
- destroyed_countries = []
- def login():
- print "Please enter your username: "
- username = raw_input()
- print "Please enter your password: "
- password = raw_input()
- if username == "123" and password == "123":
- perform()
- else:
- print "Invalid username and password"
- login()
- def main():
- print "Welcome to Asean domination system. What would you like to do today?"
- print "a. Show me all countries"
- print "b. How many rockets left"
- print "c. Add more rockets"
- print "d. Destroy a country"
- print "e. Show me all countries I destroyed"
- print "f. Show me all countries I have to destroy"
- print "g. Exit"
- return raw_input()
- def perform():
- selected = main()
- if selected == "a" :
- print_all_countries()
- perform()
- elif selected == "b" :
- print_all_rockets()
- perform()
- elif selected == "c":
- print_add_rockets()
- perform()
- elif selected == "d" :
- destroy_countries()
- perform()
- elif selected =="e" :
- print_all_destroyed_countries()
- perform()
- elif selected=="f" :
- print_all_alive_countries()
- perform()
- elif selected == "g":
- exit()
- else:
- print "Invalid input"
- return perform()
- def print_all_countries():
- global countries
- print "All ASEAN Countries are" + str(all_countries)
- def print_all_rockets():
- global rockets
- print "You still have " + str(rockets) + " " + "rockets"
- def print_add_rockets():
- global rockets
- print "How many rockets do you want to add?"
- add = raw_input()
- rockets =int(rockets) + int(add)
- if rockets > 0 :
- print "You have successfully added " + str(add) + " " + "rockets"
- elif add < 0:
- print "Invalid amount"
- else:
- print "Invalid amount"
- def destroy_countries():
- global rockets
- global alive_countries
- print "Which country to destroy? Please select a number."
- print "1." + " "+ alive_countries['count1']
- print "2." + " "+alive_countries['count2']
- print "3." + " "+alive_countries['count3']
- print "4." + " "+alive_countries['count4']
- print "5." + " "+alive_countries['count5']
- print "6." + " "+alive_countries['count6']
- print "7." + " "+alive_countries['count7']
- print "8." + " "+alive_countries['count8']
- print "9." + " "+alive_countries['count9']
- print "10."+ " "+alive_countries['count10']
- bomb = raw_input()
- if bomb == "1" and rockets > 0:
- print "Country was successfuly destroyed"
- destroyed_countries.append(alive_countries['count1'])
- des_count()
- perform()
- elif bomb == "2" and rockets > 0:
- print "Country was successfuly destroyed"
- destroyed_countries.append(alive_countries['count2'])
- des_count()
- perform()
- elif bomb == "3" and rockets > 0:
- print "Country was successfuly destroyed"
- destroyed_countries.append(alive_countries['count3'])
- des_count()
- perform()
- elif bomb == "4" and rockets > 0:
- print "Country was successfuly destroyed"
- destroyed_countries.append(alive_countries['count4'])
- des_count()
- perform()
- elif bomb == "5":
- print "You cannot destroyed your own country"
- perform()
- elif bomb == "6" and rockets >0:
- print "Country was successfuly destroyed"
- destroyed_countries.append(alive_countries['count6'])
- des_count()
- perform()
- elif bomb == "7" and rockets >0:
- print "Country was successfuly destroyed"
- destroyed_countries.append(alive_countries['count7'])
- des_count()
- perform()
- elif bomb == "8" and rockets >0:
- print "Country was successfuly destroyed"
- destroyed_countries.append(alive_countries['count8'])
- des_count()
- perform()
- elif bomb == "9" and rockets >0:
- print "Country was successfuly destroyed"
- destroyed_countries.append(alive_countries['count9'])
- des_count()
- perform()
- elif bomb == "10" and rockets >0:
- print "Country was successfuly destroyed"
- destroyed_countries.append(alive_countries['count10'])
- des_count()
- perform()
- else:
- print "You cannot destroy a country without rocket"
- perform()
- def print_all_destroyed_countries():
- global destroyed_countries
- print "You destroyed" + " " + str(destroyed_countries)
- perform()
- def print_all_alive_countries():
- global alive_countries
- print "You have not yet destroyed" + " " + alive_countries['count1'] + " " + alive_countries['count2'] + " " + alive_countries['count3'] + " " + alive_countries['count4'] + " "+ alive_countries['count6'] + " " + alive_countries['count7'] + " " + alive_countries['count8'] + " " + alive_countries['count9'] + " " + alive_countries['count10']
- def des_count():
- global rockets
- rockets = int(rockets) - 1
- login()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement