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

Update PythonGame

parent 0c9c3eb8
......@@ -15,6 +15,8 @@ insurance = ["high", "low", "none"]
firstcontract = ["1", "2", "3"]
directions = ["left", "right", "forward", "reverse"]
route = ["route 1", "route 2"]
shipindex = ["0","1","2","3","4","exit"]
###############################################################################################
# Integers #
......@@ -25,6 +27,7 @@ contract = 0
difficulty = 0
payoutloss = 0
date = 0
shipno = 0
################################################################################################
# Routes #
################################################################################################
......@@ -48,6 +51,17 @@ Outcomes = [
['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.
# Player will set up their company, picking difficulty and insurance.
# After they will pick the contracts and start playing.
......@@ -86,6 +100,8 @@ print("Captain " + playername + ", I like it!\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("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 = input("What will you call it?\n")
......@@ -227,6 +243,8 @@ while date < 32:
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.")
bankbal = bankbal - Ships[shipno][5]
input("Press 'Enter' to continue")
clear()
......@@ -244,6 +262,33 @@ while date < 32:
bankbal = bankbal + income
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")
if bankbal is 0 or bankbal < 0:
break
......
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