Commit 1f8c76b3 authored by Reece's avatar Reece

Added randomness

I have added an element of randomness, It isn't finished yet because I am bored and need to eat, but as it is, it works. I've also made it so it goes through the days and there will be outcomes of each day, will add them later.

After, the ending needs to come, idk if there will be more than 1 route and then the end but it can easily be changed later.
parent 1b600987
import os
from random import randint
def clear():
os.system("clear")
os.system("cls")
############################################################################################### ###############################################################################################
# PlayerCommands# # PlayerCommands #
############################################################################################### ###############################################################################################
yes_no = ["yes", "no"] yes_no = ["yes", "no"]
...@@ -10,141 +17,158 @@ directions = ["left", "right", "forward", "reverse"] ...@@ -10,141 +17,158 @@ 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 contract = 0
contract2 = 0
contract3 = 0
contractpicked = 0
################################################################################################ ################################################################################################
#routes# # Routes #
################################################################################################ ################################################################################################
route1 = 0 route1 = 0
route2 = 0 route2 = 0
# intro
#playername Routes = [
playername = input("What is your name captain?\n") ['Roswyth Docks - Aberdeen', 'Port of Gothenburg - Sweden', 3, 200000],
print("Good morning Captain " + playername + "\n\nWhat is your ships name?") ['Scotland -> France', '7 days', 10000, 'I went to France once, but it wasn\'t for me. Anyway that doesn\'t matter, pretty simple one this run, just get to France in 7 days and get paid.'],
['Scotland -> Portugal', 'dunno', 75000, 'Easy enough, just be careful the sea can get a bit rough.']
]
Outcomes = [
[]
]
# Start of the game.
# Player will set up their company, picking difficulty and insurance.
# After they will pick the contracts and start playing.
# Clears the screen
clear()
print("Hello!...\nWelcome to the company start up centre.\nI'm dave, your company advisor. I have already read your application and it looks like you want to start a freight company")
print("In order to help you out, we will need some information from you.\n")
# playername
playername = input("Firstly, what is your name?\n")
#shipname print("Captain " + playername + ", I like it!\n")
shipname = input("")
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 ")
# shipname
shipname = input("What will you call it?\n")
if shipname.lower() == "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")
print("Hmm.. The last time I saw a ship with that name it didn't go well, but I trust you will take care this time.\n")
else: else:
print("Excellent name Captain. SS." +shipname+ " it is.\n") print("Perfect!\nSS." + shipname + " it is.")
input("Press 'Enter' to continue\n")
############################################################################################### ###############################################################################################
#difficulty setting# # Difficulty setting #
############################################################################################### ###############################################################################################
clear()
response1 = "" response1 = ""
while response1.lower() not in cash: while response1.lower() not in cash:
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") response1 = input("Now Captain " + playername + ", the 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").lower()
if response1.lower() == "easy": if response1 == "easy":
bankbal= 2000000 bankbal = 2000000
elif response1.lower() == "normal": elif response1 == "normal":
bankbal = 1000000 bankbal = 1000000
elif response1.lower() == "hard": elif response1 == "hard":
bankbal = 500000 bankbal = 500000
else: print("Captain " +playername+ ", I'm not sure what you said there please try again.\n") else:
print("Sorry Captain " + playername + ", I'm not sure what you said there, please try again.\n");
print("Very well, we will loan you the money. Naturally, we would expect the cash back but any profit you make you are welcome to keep.\nIf you do not make any money, we will no longer be able to fund you")
input("Press 'Enter' to continue")
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 #
############################################################################################# #############################################################################################
clear()
print("--- Summary ---\nCompany name: " + companyName + "\nBank balance: £", bankbal)
response2 = "" response2 = ""
while response2.lower() 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 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") 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").lower()
if response2 == "high": if response2 == "high":
insurancevalue = 2 insurancevalue = 2
bankbal = bankbal-200000 bankbal = bankbal-200000
print("Excellent choice captain, exactly what i would have gone for myself\n") print("Excellent choice Captain, exactly what I would have gone for myself\n")
print("----------------------------------------------------------------------------\nYou choose the high value insurance. Your bank balance is now £",bankbal,"\n----------------------------------------------------------------------------") print("You choose the high value insurance. Your bank balance is now £", bankbal, "\n")
print("\n")
elif response2 == "low": elif response2 == "low":
insurancevalue = 1 insurancevalue = 1
bankbal = bankbal - 50000 bankbal = bankbal - 50000
print("Well captain that would have been my first choice but you're in charge\n") print("Well Captain, that would have been my first choice but you're in charge\n")
print("You choose the low value insurance. Your bank balance is now £",bankbal) print("You choose the low value insurance. Your bank balance is now £", bankbal, "\n")
print("\n")
elif response2 == "none": elif response2 == "none":
insurancevalue = 0 insurancevalue = 0
print("Well i'm not going to say that it's a stupid idea captain but you are the one in charge") print("Well i'm not going to say that it's a stupid idea Captain but you are the one in charge")
print("You choose not to buy insurance. Your bank balance is now £",bankbal ) print("You choose not to buy insurance. Your bank balance is now £", bankbal, "\n")
print("\n")
else: else:
print("I'm sorry captain could you please say that again?\n") print("I'm sorry captain could you please say that again?\n")
print("Congratulations Captain " + playername + ", your insurance has been approved and you're ready to set sail.\nGet some rest and we will head over to the contracts office tomorrow morning.")
input("Press 'Enter' to continue")
################################################################################################ ################################################################################################
#game start# # Contract selection #
################################################################################################ ################################################################################################
print("\n-----------------------------------------------------\nCongratulations Captain "+playername+" you're all ready to set sail. Get some rest and we will head over to the contracts office tomorrow morning.\n-----------------------------------------------------\n\n")
("DAY 1\nBalance-£",bankbal,"\nWeather:Clear\nLocation:Contracts Office\n")
clear()
print("--- Summary ---\nCompany name: " + companyName + "\nBank Balance: £", bankbal, "\nWeather: Clear\nLocation: Contracts Office\n")
###############################################################################################
#BUY CONTRACT#
##############################################################################################
response3 = "" response3 = ""
while response3 not in firstcontract: while response3 not in firstcontract:
response3 = input("Good Morning captain we have 3 contracts available for you to carry out. Please take a look....\n\nCONTRACT 1 ~ COST: £200,000 ~ PAYOUT ~ £1,000,000 ~\n-Cargo in excess of £10,000,000\n-Scotland -> Sweden\n-3 Day limit from acceptance of contract\n\nCONTRACT 2 ~ COST:£10,000 ~ PAYOUT ~ £50,000~\n-Cargo in excess of £100,000\n-Scotland -> France\n-7 day time limit from acceptance of contract\n\nCONTRACT 3 ~ COST: :£75,000 ~ PAYOUT ~ £600,000~\n-Cargo in excess of £2,500,000\n-Scotland -> Portugal\n-5 day time limit from acceptance of contract\n\nplease pick a contract 1/2/3\n") response3 = input("Good Morning captain we have 3 contracts available for you to carry out. Please take a look....\n\nCONTRACT 1 ~ COST: £200,000 ~ PAYOUT ~ £1,000,000 ~\n-Cargo in excess of £10,000,000\n-Scotland -> Sweden\n-3 Day limit from acceptance of contract\n\nCONTRACT 2 ~ COST:£10,000 ~ PAYOUT ~ £50,000~\n-Cargo in excess of £100,000\n-Scotland -> France\n-7 day time limit from acceptance of contract\n\nCONTRACT 3 ~ COST: :£75,000 ~ PAYOUT ~ £600,000~\n-Cargo in excess of £2,500,000\n-Scotland -> Portugal\n-5 day time limit from acceptance of contract\n\nplease pick a contract 1/2/3\n")
if response3 == "1": if response3 == "1":
contract1 = 3 contract = 0
contractpicked = 1
bankbal = bankbal-200000 bankbal = bankbal-200000
print("Okay Scotland to Sweden. Please be careful with this cargo its worth a lot of money and is very important. You have 3 days to get there so you may want to get a move on captain.\n") print("Okay Scotland to Sweden. Please be careful with this cargo its worth a lot of money and is very important. You have 3 days to get there so you may want to get a move on captain.\n")
elif response3 == "2": elif response3 == "2":
contract2 = 7 contract = 1
contractpicked = 2
bankbal = bankbal-10000 bankbal = bankbal-10000
print("Scotland to France. I went to France once but it wasnt for me. Anyway that doesn't matter, pretty simple one this run just get to France in 7 days and get paid.\n") print("Scotland to France. I went to France once but it wasnt for me. Anyway that doesn't matter, pretty simple one this run just get to France in 7 days and get paid.\n")
elif response3 == "3": elif response3 == "3":
contract3 = 5 contract = 2
contractpicked = 3
bankbal = bankbal-75000 bankbal = bankbal-75000
print("Scotland to Portugal, easy enough just be careful the sea can get a bit rough.\n") print("Scotland to Portugal, easy enough just be careful the sea can get a bit rough.\n")
else: else:
print("Have you been in the pub again captain? you aren't making any sense try saying that again but slower") print("Have you been in the pub again captain? you aren't making any sense try saying that again but slower")
input("Press 'Enter' to continue")
###################################################################################### ######################################################################################
#DAY 1# CONTRACT 1 #DAY 1# CONTRACT 1
###################################################################################### ######################################################################################
print("DAY 1") clear()
print("--- Summary ---\nCompany name: " + companyName + "\nBank balance: ", bankbal, "\nSchedule: Day of departure\nTime: 12:36pm\nWeather: Fair")
print("WEATHER: FAIR") print("----------------------------------------------\nCurrent Location: " + Routes[contract][0] + "\nTarget Location: " + Routes[contract][1] + "\nContract duration:", Routes[contract][2])
print("TIME: 12:36pm") print("")
print("BALANCE: £",bankbal) input("Press 'Enter' to continue")
for i in range(Routes[contract][2]):
day = i+1
print("--- Summary ---\nDay:", day, "\nTime: ", randint(1, 12), ":",
randint(1, 60), "\nCurrent Status: En-route\n-------------------------\n")
print("Trip details:\Random outcome here...")
input("Press 'Enter' to continue")
input("End of trip")
if contractpicked == 1: if contractpicked == 1:
...@@ -219,6 +243,19 @@ while response5 not in route: ...@@ -219,6 +243,19 @@ while response5 not in route:
print("You take the faster route as the rain begins to get gradually heavier and heavier\n\n") print("You take the faster route as the rain begins to get gradually heavier and heavier\n\n")
print("DAY 2") print("DAY 2")
print("WEATHER: Heavy Rain") print("WEATHER: Heavy Rain")
......
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