Compare commits
2 Commits
7b36c588e1
...
0dfcca72e2
Author | SHA1 | Date | |
---|---|---|---|
0dfcca72e2 | |||
0f54e2533b |
82
data.py
82
data.py
@ -1,36 +1,58 @@
|
|||||||
businesses = [
|
businesses = [
|
||||||
{"pretty_name":"Paper Round","cost":10,"earning":0.11,"threat":0},
|
{"pretty_name":"Paper Round", "cost":10,"earning":0.11,"threat":0},
|
||||||
{"pretty_name":"Car Boot Sale","cost":20,"earning":0.22,"threat":15},
|
{"pretty_name":"Car Boot Sale", "cost":20,"earning":0.22,"threat":15},
|
||||||
{"pretty_name":"Lemonade Stand","cost":60,"earning":0.69,"threat":0},
|
{"pretty_name":"Lemonade Stand", "cost":60,"earning":0.69,"threat":0},
|
||||||
{"pretty_name":"Online Reseller","cost":105,"earning":1.30,"threat":4},
|
{"pretty_name":"Online Reseller", "cost":105,"earning":1.30,"threat":4},
|
||||||
{"pretty_name":"Open Source Maintainer","cost":110,"earning":0.01,"threat":-0.01},# Positive affect
|
{"pretty_name":"Open Source Maintainer", "cost":110,"earning":0.01,"threat":-0.01},# Positive affect
|
||||||
{"pretty_name":"Weed Dealer","cost":120,"earning":10,"threat":30},# High risk
|
{"pretty_name":"Weed Dealer", "cost":120,"earning":10,"threat":30},# High risk
|
||||||
{"pretty_name":"Pizza Delivery","cost":130,"earning":2,"threat":1},
|
{"pretty_name":"Pizza Delivery", "cost":130,"earning":2,"threat":1},
|
||||||
{"pretty_name":"Lawn Mower","cost":250,"earning":1.5,"threat":-0.03},
|
{"pretty_name":"Lawn Mower", "cost":250,"earning":1.5,"threat":-0.03},
|
||||||
{"pretty_name":"Cocaine Smuggler","cost":550,"earning":48,"threat":50},# High risk
|
{"pretty_name":"Cocaine Smuggler", "cost":550,"earning":48,"threat":50},# High risk
|
||||||
{"pretty_name":"Photo Booth","cost":2180,"earning":30,"threat":2},
|
{"pretty_name":"Photo Booth", "cost":2180,"earning":30,"threat":2},
|
||||||
{"pretty_name":"Car Wash","cost":3000,"earning":40,"threat":4},
|
{"pretty_name":"Car Wash", "cost":3000,"earning":40,"threat":4},
|
||||||
{"pretty_name":"Charity Cake Sale","cost":3900,"earning":0,"threat":-0.4},
|
{"pretty_name":"Charity Cake Sale", "cost":3900,"earning":0,"threat":-0.4},
|
||||||
{"pretty_name":"Hotdog Stand","cost":5700,"earning":80,"threat":2},
|
{"pretty_name":"Hotdog Stand", "cost":5700,"earning":80,"threat":2},
|
||||||
{"pretty_name":"Shoe Shop","cost":9800,"earning":140,"threat":5},
|
{"pretty_name":"Shoe Shop", "cost":9800,"earning":140,"threat":5},
|
||||||
{"pretty_name":"Cake Shop","cost":15000,"earning":215,"threat":1},
|
{"pretty_name":"Cake Shop", "cost":15000,"earning":215,"threat":1},
|
||||||
{"pretty_name":"Pub","cost":22000,"earning":360,"threat":18},
|
{"pretty_name":"Pub", "cost":22000,"earning":360,"threat":18},
|
||||||
{"pretty_name":"Charity Shop","cost":27500,"earning":2.5,"threat":-2.75},# Positive affect
|
{"pretty_name":"Charity Shop", "cost":27500,"earning":2.5,"threat":-2.75},# Positive affect
|
||||||
{"pretty_name":"Corner Shop","cost":32500,"earning":460,"threat":5},
|
{"pretty_name":"Corner Shop", "cost":32500,"earning":460,"threat":5},
|
||||||
{"pretty_name":"Casino","cost":47500,"earning":5120,"threat":40},# High risk
|
{"pretty_name":"Casino", "cost":47500,"earning":5120,"threat":40},# High risk
|
||||||
{"pretty_name":"Petrol Station","cost":90000,"earning":1350,"threat":8},
|
{"pretty_name":"Petrol Station", "cost":90000,"earning":1350,"threat":8},
|
||||||
{"pretty_name":"Community Space","cost":125875,"earning":0.5,"threat":-15},# Positive affect
|
{"pretty_name":"Community Space", "cost":125875,"earning":0.5,"threat":-15},# Positive affect
|
||||||
{"pretty_name":"Fast Food Chain","cost":280000,"earning":4500,"threat":5},
|
{"pretty_name":"Car Dealership", "cost":184000,"earning":2900,"threat":8},
|
||||||
{"pretty_name":"Tech Startup","cost":565000,"earning":9100,"threat":12},
|
{"pretty_name":"Fast Food Chain", "cost":280000,"earning":4500,"threat":5},
|
||||||
{"pretty_name":"Advertising Agency","cost":875000,"earning":14500,"threat":6},
|
{"pretty_name":"Tech Startup", "cost":565000,"earning":9100,"threat":12},
|
||||||
{"pretty_name":"Mini Golf Course","cost":900000,"earning":17000,"threat":2},
|
{"pretty_name":"Advertising Agency", "cost":875000,"earning":14500,"threat":6},
|
||||||
{"pretty_name":"Botanical Garden","cost":1000000,"earning":20,"threat":-130},# Positive affect
|
{"pretty_name":"Mini Golf Course", "cost":900000,"earning":17000,"threat":2},
|
||||||
{"pretty_name":"Golf Course","cost":5000000,"earning":89500,"threat":4},
|
{"pretty_name":"Botanical Garden", "cost":1000000,"earning":20,"threat":-130},# Positive affect
|
||||||
{"pretty_name":"Bank","cost":12500000,"earning":231600,"threat":1},
|
{"pretty_name":"Golf Course", "cost":5000000,"earning":89500,"threat":4},
|
||||||
{"pretty_name":"Gold Mine","cost":1200000000,"earning":28512500,"threat":12},
|
{"pretty_name":"Drug Empire", "cost":6730000,"eanring":828240,"threat":80},# High Risk
|
||||||
|
{"pretty_name":"Bank", "cost":12500000,"earning":231600,"threat":1},
|
||||||
|
{"pretty_name":"Hogwarts", "cost":38890000,"earning":690000,"threat":12},
|
||||||
|
{"pretty_name":"Car Manufacturer", "cost":95000000,"earning":1853838,"threat":6},
|
||||||
|
{"pretty_name":"World Heritage Site", "cost":273812672,"earning":-100,"threat":-42000},# Positive affect
|
||||||
|
{"pretty_name":"Gold Mine", "cost":1200000000,"earning":28512500,"threat":12},
|
||||||
|
{"pretty_name":"Record Label", "cost":16086117467,"earning":377219792,"threat":4},
|
||||||
|
{"pretty_name":"North Korean Hackers", "cost":49090934652,"earning":1197973460,"threat":390},# High Risk
|
||||||
|
{"pretty_name":"Royal Mint", "cost":31418198177,"earning":754581418,"threat":0},
|
||||||
|
{"pretty_name":"Nuclear Power Plant", "cost":149813643350,"earning":3804520446,"threat":12},
|
||||||
|
{"pretty_name":"Mithril Mine", "cost":187267054187,"earning":4793695763,"threat":24},# High Risk
|
||||||
|
{"pretty_name":"Asgardian Bank", "cost":2730000000000,"earning":76800000000,"threat":2},
|
||||||
|
{"pretty_name":"HS2", "cost":80265000000000,"earning":2000000000000,"threat":2},
|
||||||
|
{"pretty_name":"McDuck Enterprises", "cost":1752500000000000,"earning":62497524783840,"threat":4},
|
||||||
|
{"pretty_name":"Silmaril Factory", "cost":40000000000000000,"earning":1588731290169286,"threat":84},# High Risk
|
||||||
|
{"pretty_name":"Death Star I", "cost":850000000000000000,"earning":37600000000000000,"threat":110}, # High Risk
|
||||||
|
{"pretty_name":"Death Star II", "cost":113000000000000000,"earning":5089000000000000,"threat":110}, # High Risk
|
||||||
|
{"pretty_name":"Starkiller Base", "cost":9315000000000000000,"earning":480000000000000000,"threat":200}, #High Risk
|
||||||
|
{"pretty_name":"Duplication Exploiter", "cost":32300000000000000000,"earning":1630000000000000000,"threat":128},# High Risk
|
||||||
|
{"pretty_name":"Midas Touch Factory", "cost":470000000000000000000,"earning":26000000000000000000,"threat":1400},#High Risk
|
||||||
]
|
]
|
||||||
leaderboard = [
|
leaderboard = [
|
||||||
|
["King Midas",641990000000000000000000000],
|
||||||
["Scrooge McDuck", 18921600000000000000],
|
["Scrooge McDuck", 18921600000000000000],
|
||||||
|
["Rumpelstiltskin", 2910000000000000000],
|
||||||
|
["Emperor Palpatine", 984000000000000000],
|
||||||
["Thor", 15000000000000000],
|
["Thor", 15000000000000000],
|
||||||
["Namor", 800000000000000],
|
["Namor", 800000000000000],
|
||||||
["Plutus", 662000000000000],
|
["Plutus", 662000000000000],
|
||||||
@ -50,7 +72,7 @@ leaderboard = [
|
|||||||
["Alan Rufus", 195000000000],
|
["Alan Rufus", 195000000000],
|
||||||
["Larry Ellison", 192000000000],
|
["Larry Ellison", 192000000000],
|
||||||
["Bernard Arnault", 178000000000],
|
["Bernard Arnault", 178000000000],
|
||||||
["Marcus Lucinius Crassus",169800000000],
|
["Marcus Lucinius Crassus", 169800000000],
|
||||||
["Basil II", 169400000000],
|
["Basil II", 169400000000],
|
||||||
["Warren Buffet", 154000000000],
|
["Warren Buffet", 154000000000],
|
||||||
["Frodo Baggins", 145400000000],
|
["Frodo Baggins", 145400000000],
|
||||||
|
41
main.py
41
main.py
@ -1,3 +1,4 @@
|
|||||||
|
#TODO comments explaining stuff
|
||||||
import data # Import data.py which contains the businesses and leaderboards
|
import data # Import data.py which contains the businesses and leaderboards
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import math
|
import math
|
||||||
@ -7,28 +8,25 @@ except:
|
|||||||
with open("save.py", "w") as file:
|
with open("save.py", "w") as file:
|
||||||
content = f"businesses = []\nmoney = 100\ndatetime = {datetime.now().strftime('%s')}\nfine_count = 0"
|
content = f"businesses = []\nmoney = 100\ndatetime = {datetime.now().strftime('%s')}\nfine_count = 0"
|
||||||
# Commands
|
# Commands
|
||||||
# TODO help: help's the user
|
# help: help's the user
|
||||||
# status: output's networth, available money, TL, your businesses and earning/hour
|
# status: output's networth, available money, TL, your businesses and earning/hour
|
||||||
# shop/buy: lists available businesses
|
# shop/buy: lists available businesses
|
||||||
# sell: sells that business
|
# sell: sells that business
|
||||||
# leaderboard: shows the wealth leaderboard
|
# leaderboard: shows the wealth leaderboard
|
||||||
# quit: exit's game
|
# quit: exit's game
|
||||||
|
# TODO upgrade: upgrades some stats about a business for some money
|
||||||
|
|
||||||
# Additional functionality:
|
# Additional functionality:
|
||||||
# randomly get sent to get fined based on threat level, more than 5 fines means next time is prision and that's 2 years ingame
|
# randomly get sent to get fined based on threat level, more than 5 fines means next time is prision and that's 2 years ingame
|
||||||
# permanent saves
|
# permanent saves
|
||||||
|
|
||||||
# https://stackoverflow.com/questions/3154460/python-human-readable-large-numbers
|
|
||||||
def millify(n):
|
def millify(n):
|
||||||
n = float(n)
|
exponent = len(str(round(n))) - 1 # n = 1,000 return 3, n = 300,000 returns 5
|
||||||
millidx = max(
|
millvalue = exponent//3
|
||||||
0,
|
millname = data.millnames[millvalue] # exponent = 3 returns K (thousand), exponent = 7 returns M (million)
|
||||||
min(
|
#print(f"E: {exponent}, M: {millname}, Mv: {millvalue} = ",end="")
|
||||||
len(data.millnames)-1,
|
return f"{round((n/(10**(millvalue*3))),2)}{millname}"
|
||||||
int(math.floor(0 if n == 0 else math.log10(abs(n))/3))
|
#return '{:.0f}{}'.format(n / 10**(3 * millidx), data.millnames[millidx])
|
||||||
)
|
|
||||||
)
|
|
||||||
return '{:.0f}{}'.format(n / 10**(3 * millidx), data.millnames[millidx])
|
|
||||||
|
|
||||||
def rand_bool(percent):
|
def rand_bool(percent):
|
||||||
return random.randrange(100) < percent
|
return random.randrange(100) < percent
|
||||||
@ -79,7 +77,7 @@ def main():
|
|||||||
game_loop = True
|
game_loop = True
|
||||||
while game_loop:
|
while game_loop:
|
||||||
save.datetime = datetime.now().strftime("%s")
|
save.datetime = datetime.now().strftime("%s")
|
||||||
print(f"{data.currency}{round(save.money,2)} > ", end="")
|
print(f"{data.currency}{millify(save.money)} > ", end="")
|
||||||
user_input = input()
|
user_input = input()
|
||||||
# TODO make this a match case?
|
# TODO make this a match case?
|
||||||
if user_input.lower() == "quit" or user_input.lower() == "exit":
|
if user_input.lower() == "quit" or user_input.lower() == "exit":
|
||||||
@ -93,7 +91,7 @@ def main():
|
|||||||
print(" 0: cancel")
|
print(" 0: cancel")
|
||||||
for i in range(len(data.businesses)):
|
for i in range(len(data.businesses)):
|
||||||
if data.businesses[i]['cost'] <= save.money:
|
if data.businesses[i]['cost'] <= save.money:
|
||||||
print(f" {i+1}: {data.businesses[i]['pretty_name']}: {data.currency}{data.businesses[i]['cost']}, Earning: {data.currency}{data.businesses[i]['earning']}/hour, Threat: {data.businesses[i]['threat']}%")
|
print(f" {i+1}: {data.businesses[i]['pretty_name']}: {data.currency}{millify(data.businesses[i]['cost'])}, Earning: {data.currency}{millify(data.businesses[i]['earning'])}/hour, Threat: {data.businesses[i]['threat']}%")
|
||||||
user_input = input()
|
user_input = input()
|
||||||
try:
|
try:
|
||||||
user_input_int = int(user_input) - 1
|
user_input_int = int(user_input) - 1
|
||||||
@ -112,31 +110,28 @@ def main():
|
|||||||
elif user_input.lower() == "sell":
|
elif user_input.lower() == "sell":
|
||||||
print(" 0: cancel")
|
print(" 0: cancel")
|
||||||
for i in range(len(save.businesses)):
|
for i in range(len(save.businesses)):
|
||||||
print(f" {i+1}: {save.businesses[i]['pretty_name']}: {data.currency}{save.businesses[i]['cost']}")
|
print(f" {i+1}: {save.businesses[i]['pretty_name']}: {data.currency}{millify(save.businesses[i]['cost'])}")
|
||||||
user_input = input()
|
user_input = input()
|
||||||
try:
|
|
||||||
user_input_int = int(user_input) - 1
|
user_input_int = int(user_input) - 1
|
||||||
if user_input_int == -1:
|
if user_input_int == -1:
|
||||||
continue
|
continue
|
||||||
elif user_input_int < len(data.businesses):
|
elif user_input_int < len(data.businesses):
|
||||||
print(f"Selling {data.businesses[user_input_int]['pretty_name']}")
|
print(f"Selling {save.businesses[user_input_int]['pretty_name']}")
|
||||||
|
save.money += save.businesses[user_input_int]['cost']
|
||||||
save.businesses.pop(user_input_int)
|
save.businesses.pop(user_input_int)
|
||||||
save.money += data.businesses[user_input_int]['cost']
|
|
||||||
else:
|
else:
|
||||||
print("Invalid number")
|
print("Invalid number")
|
||||||
except:
|
|
||||||
print("Didn't input a number")
|
|
||||||
|
|
||||||
### Display info relavent to your enterprise
|
### Display info relavent to your enterprise
|
||||||
elif user_input.lower() == "status":
|
elif user_input.lower() == "status":
|
||||||
print("------------- STATUS -------------")
|
print("------------- STATUS -------------")
|
||||||
print(f"Money Available: {data.currency}{round(save.money,2)}")
|
print(f"Money Available: {data.currency}{millify(save.money)}")
|
||||||
print("Your businesses:")
|
print("Your businesses:")
|
||||||
total_earning = 0
|
total_earning = 0
|
||||||
networth = save.money
|
networth = save.money
|
||||||
threat = 0
|
threat = 0
|
||||||
for biz in save.businesses:
|
for biz in save.businesses:
|
||||||
print(f" {biz['pretty_name']}: {data.currency}{biz['earning']}/hour")
|
print(f" {biz['pretty_name']}: {data.currency}{millify(biz['earning'])}/hour")
|
||||||
total_earning += biz['earning']
|
total_earning += biz['earning']
|
||||||
networth += biz['cost']
|
networth += biz['cost']
|
||||||
threat += biz['threat']
|
threat += biz['threat']
|
||||||
@ -145,8 +140,8 @@ def main():
|
|||||||
print(f"Threat Level: {threat}%")
|
print(f"Threat Level: {threat}%")
|
||||||
else:
|
else:
|
||||||
print("Threat Level: MIDNIGHT")
|
print("Threat Level: MIDNIGHT")
|
||||||
print(f"Total earning: {data.currency}{total_earning}/hour")
|
print(f"Total earning: {data.currency}{millify(total_earning)}/hour")
|
||||||
print(f"Networth: {data.currency}{round(networth,2)}")
|
print(f"Networth: {data.currency}{millify(networth)}")
|
||||||
print("----------------------------------")
|
print("----------------------------------")
|
||||||
|
|
||||||
### Display leaderboard
|
### Display leaderboard
|
||||||
|
Loading…
x
Reference in New Issue
Block a user