Commit a2f0ecbf authored by simon.nutsey's avatar simon.nutsey

Update PythonGame

parent 0c9c3eb8
...@@ -15,6 +15,8 @@ insurance = ["high", "low", "none"] ...@@ -15,6 +15,8 @@ insurance = ["high", "low", "none"]
firstcontract = ["1", "2", "3"] firstcontract = ["1", "2", "3"]
directions = ["left", "right", "forward", "reverse"] directions = ["left", "right", "forward", "reverse"]
route = ["route 1", "route 2"] route = ["route 1", "route 2"]
shipindex = ["0","1","2","3","4","exit"]
############################################################################################### ###############################################################################################
# Integers # # Integers #
...@@ -25,6 +27,7 @@ contract = 0 ...@@ -25,6 +27,7 @@ contract = 0
difficulty = 0 difficulty = 0
payoutloss = 0 payoutloss = 0
date = 0 date = 0
shipno = 0
################################################################################################ ################################################################################################
# Routes # # Routes #
################################################################################################ ################################################################################################
...@@ -48,6 +51,17 @@ Outcomes = [ ...@@ -48,6 +51,17 @@ Outcomes = [
['Stormy', 3, 'Dialog', 'Dialog', 'Dialog', 10000] ['Stormy', 3, 'Dialog', 'Dialog', 'Dialog', 10000]
] ]
##############################################################################
# SHIPS
##############################################################################
# Shipname, Ship number, length, cargo, cost, opcost
Ships = [
['Birmingham',0,300,50000,50000,1000],
['London',1,400,75000,100000,1400],
['Edinburgh',2,500,100000,200000,1800],
['Manchester',3,600,125000,350000,2100],
['York',4,700,150000,500000,2500]
]
# Start of the game. # Start of the game.
# Player will set up their company, picking difficulty and insurance. # Player will set up their company, picking difficulty and insurance.
# After they will pick the contracts and start playing. # After they will pick the contracts and start playing.
...@@ -86,6 +100,8 @@ print("Captain " + playername + ", I like it!\n") ...@@ -86,6 +100,8 @@ print("Captain " + playername + ", I like it!\n")
companyName = input("What is your company called?\n") companyName = input("What is your company called?\n")
print("Okay, I am registering " + companyName + ".\nIn order for your to get on your feet, we will give you a ship for free.\n ") print("Okay, I am registering " + companyName + ".\nIn order for your to get on your feet, we will give you a ship for free.\n ")
print("Your starting ship:\n BIRMINGHAM CLASS FREIGHTER\n Length: 300ft\n Cargo: 50,000 tons\n Operating Cost: 10,000 per day\n\n")
# shipname # shipname
shipname = input("What will you call it?\n") shipname = input("What will you call it?\n")
...@@ -227,6 +243,8 @@ while date < 32: ...@@ -227,6 +243,8 @@ while date < 32:
elif (Outcomes[outcome][1] == 3): elif (Outcomes[outcome][1] == 3):
print("Dave: I\'m suprised we are still alive, unfortunatly we have lost £", Outcomes[outcome][5], " worth of cargo. I don\'t know how you\'re going to explain this.") print("Dave: I\'m suprised we are still alive, unfortunatly we have lost £", Outcomes[outcome][5], " worth of cargo. I don\'t know how you\'re going to explain this.")
bankbal = bankbal - Ships[shipno][5]
input("Press 'Enter' to continue") input("Press 'Enter' to continue")
clear() clear()
...@@ -243,6 +261,33 @@ while date < 32: ...@@ -243,6 +261,33 @@ while date < 32:
print("----------------------------------------------\nCurrent Location: " + Routes[contract][2] + "\nContract payout: ", Routes[contract][4], "\nPenalties: ", payoutloss, "\nTotal Income from Haul: ", income) print("----------------------------------------------\nCurrent Location: " + Routes[contract][2] + "\nContract payout: ", Routes[contract][4], "\nPenalties: ", payoutloss, "\nTotal Income from Haul: ", income)
bankbal = bankbal + income bankbal = bankbal + income
print("") print("")
shipmarket = ""
shipmarket = input("Would you like to purchase a new ship yes/no?")
while shipmarket.lower() in yes_no:
if shipmarket.lower() == "no":
break
if shipmarket.lower() == "yes":
print ("Welcome to the ship market. Your current ship is " + shipname + " " + Ships[shipno][0] + " class\n\n")
print ("Available ships:\n\n")
for i in range(5):
print("Ship number: " + str(Ships[i][1]) + " Name: " + Ships[i][0] + " Length: " + str(Ships[i][2]) + " Cargo (tons): " + str(Ships[i][3]) + " Cost:" + str(Ships[i][4]) + " OpCost (per day):" + str(Ships[i][5]))
shipselect =""
shipselect = input("Please enter a ship number or 'exit' to continue")
while shipselect in shipindex:
if shipselect == "exit":
break
shipno = int(shipselect)
bankbal = bankbal - Ships[shipno][3]
print("You have purchased a new "+Ships[shipno][0])
break
break
else: ("Please input again")
input("Press 'Enter' to continue") input("Press 'Enter' to continue")
if bankbal is 0 or bankbal < 0: if bankbal is 0 or bankbal < 0:
......
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