Commit cd2e70b3 authored by Reece's avatar Reece

Optimization

Changed a few bits of code it was easier to read.
parent 11e542ca
{
"python.pythonPath": "D:\\Program Files (x86)\\Python\\Python 3.8.2\\python.exe"
}
\ No newline at end of file
...@@ -4,93 +4,62 @@ ...@@ -4,93 +4,62 @@
yes_no = ["yes", "no"] yes_no = ["yes", "no"]
cash = ["easy", "normal", "hard"] cash = ["easy", "normal", "hard"]
insurance = ["high","low","none"] insurance = ["high", "low", "none"]
firstcontract = ["1","2","3"] firstcontract = ["1", "2", "3"]
directions = ["left","right","forward"] directions = ["left", "right", "forward", "reverse"]
route = ["route 1","route 2"] route = ["route 1", "route 2"]
############################################################################################### ###############################################################################################
#integers# #integers#
############################################################################################### ###############################################################################################
bankbal = 0 bankbal = 0
insurancevalue = 0 insurancevalue = 0
contract1 = 0 contract1 = 0
contract2 = 0 contract2 = 0
contract3 = 0 contract3 = 0
contractpicked = 0 contractpicked = 0
################################################################################################ ################################################################################################
#routes# #routes#
################################################################################################ ################################################################################################
route1 = 0 route1 = 0
route2 = 0 route2 = 0
# intro # intro
#playername #playername
playername = input("What is your name captain?\n") playername = input("What is your name captain?\n")
print("Good morning Captain " + playername + "\n\nWhat is your ships name?") print("Good morning Captain " + playername + "\n\nWhat is your ships name?")
#shipname #shipname
shipname = input("") shipname = input("")
print("Excellent name Captain. SS." +shipname+ " it is.\n")
if shipname == "titanic": if shipname.lower() == "titanic":
print("\033[1;32;40mWell this can only go well, look at what happened last time somebody called a ship The Titanic\n") print("\033[1;32;40mWell this can only go well, look at what happened last time somebody called a ship The Titanic\n")
else:
print("Excellent name Captain. SS." +shipname+ " it is.\n")
############################################################################################### ###############################################################################################
#difficulty setting# #difficulty setting#
############################################################################################### ###############################################################################################
response1 = "" response1 = ""
while response1 not in cash: while response1.lower() not in cash:
response1 = input("\033[0;37;0m Now Captain " + playername + ", The matter of money needs to be discussed.\n£2,000,000 Easy\n£1,000,000 Normal\n£500,000 Hard\nHow much would you like to borrow to get you started?\n\neasy/normal/hard\n") response1 = input("Now Captain " + playername + ", The matter of money needs to be discussed.\n£2,000,000 Easy\n£1,000,000 Normal\n£500,000 Hard\nHow much would you like to borrow to get you started?\n\neasy/normal/hard\n")
if response1.lower() == "easy":
if response1 == "easy":
print("Very well Captain " + playername + " We will loan you the money. Naturally at the end of the month we expect the cash back but any profit you make you are welcome to keep.\n")
bankbal= 2000000 bankbal= 2000000
print("Your current bank balance is £",bankbal) elif response1.lower() == "normal":
elif response1 == "normal":
print("Very well Captain " + playername + " We will loan you the money. Naturally at the end of the month we expect the cash back but any profit you make you are welcome to keep.\n")
bankbal = 1000000 bankbal = 1000000
print("Your current bank balance is £",bankbal) elif response1.lower() == "hard":
elif response1 == "hard":
print("\nVery well Captain " + playername + " We will loan you the money. Naturally at the end of the month we expect the cash back but any profit you make you are welcome to keep.\n")
bankbal = 500000 bankbal = 500000
print("Your current bank balance is £",bankbal) else: print("Captain " +playername+ ", I'm not sure what you said there please try again.\n")
else:
print("Captain " +playername+ " Im not sure what you said there please try again.\n")
print("Very well Captain " + playername + " We will loan you the money. Naturally at the end of the month we expect the cash back but any profit you make you are welcome to keep.\n")
print("Your current bank balance is £",bankbal)
############################################################################################# #############################################################################################
#insurance# #insurance#
############################################################################################# #############################################################################################
response2 = "" response2 = ""
while response2 not in insurance: while response2.lower() not in insurance:
response2 = input("\nThe sea can be a cruel mistress. As your adivisor I strongly urge you to get some insuance, but of course thats your choice captain. We have 2 types available, take a look....\n\nHIGH VALUE INSURANCE\n-Cargo over the value of £1,000,000 is covered\n-Loss of any cargo is covered\n-Short to long distances covered\n~Price £200,000~\n\nLOW VALUE INSURANCE\n-Cargo UP TO £1,000,000 covered\n-Loss of cargo is not covered\n-If you transport cargo over £1,000,000 the insurance will be void\n~Price £50,000~\n\nPlease pick your insurance high/low/none\n") response2 = input("\nThe sea can be a cruel mistress. As your adivisor I strongly urge you to get some insurance, but of course thats your choice captain. We have 2 types available, take a look....\n\nHIGH VALUE INSURANCE\n-Cargo over the value of £1,000,000 is covered\n-Loss of any cargo is covered\n-Short to long distances covered\n~Price £200,000~\n\nLOW VALUE INSURANCE\n-Cargo UP TO £1,000,000 covered\n-Loss of cargo is not covered\n-If you transport cargo over £1,000,000 the insurance will be void\n~Price £50,000~\n\nPlease pick your insurance high/low/none\n")
if response2 == "high": if response2 == "high":
insurancevalue = 2 insurancevalue = 2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment