-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstore_game.py
More file actions
136 lines (122 loc) · 3.83 KB
/
Copy pathstore_game.py
File metadata and controls
136 lines (122 loc) · 3.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/usr/bin/python
#Created by: Daniel R Webster
import random
import os
ran = random.randint
again = ""
goods_bought = ""
play = True
goods = 0
money = 1000
rounds = 0
buy = 0
day = 0
week = 0
year = 0
money_score = 0
score = 0
error = 0
rent = 1
version = "1.1.0"
os.system('cls')
print("Store Game V. ", version)
print("----------------------------------------------------------------")
print("Rulez:")
print("----------------------------------------------------------------")
print("Both Tax and 'Price of Good sold back' will be fixed after setting.")
print("Starting Cash at: " + str(money) + ". Max At Start is 200 Goods with cash.")
tax = input("Tax (Default is - 0.0985): ")
if tax == "":
tax = 0.0985
else:
tax = float(tax)
cost = input("Selling Price (Default is $5): ")
if cost == "":
cost = 5
else:
cost = float(cost)
again = "buy"
while play:
goods_bought = 0
if again == "buy":
goods_bought = input("Enter Number of Goods to buy and sell ($5 for each unit): ")
rounds = 0
again = ""
if goods_bought == "":
play = False
else:
goods_bought = int(goods_bought)
goods = goods + goods_bought
score = score + goods
if goods_bought*5 > money:
print("Don't Have Enough Money!")
goods_bought = 0
if goods > 0:
money = money-5*goods_bought
os.system('cls')
print("Goods Left at Start:", goods, "|", "Money: $", format(money, '.2f'))
money = money - 250
print("Paid 250 for rent.")
rent = rent - 1
while goods >= 0 and error != 1 and again == "" and money > 5 or rounds < 7 and error != 1 and again == "" and money > 5:
if 6 > goods < 15:
buy = ran(0, int(goods*0.25))
if 15 < goods > 6:
buy = ran(0, int(goods*0.1))
if goods == 2:
buy = ran(0, int())
goods = int(goods - buy)
money = money + (cost*buy) + (cost*buy)*tax
money_score = money_score + (cost*buy) + (cost*buy)*tax
rounds = rounds + 1
day = day + 1
if day == 365:
day = 0
year = year + 1
print("Year:", year, "|", "Day:", day, "|", "Goods Left:", goods, "|", "Bought:", buy, "|", "Money:", format(money, '.2f'))
while goods == 0 or rounds == 7 or error == 1:
again = input("What to do (buy/end game/none)? ")
if again == "buy":
error = 0
break
if again == "none":
error = 0
break
if again == "end game":
error = 0
play = False
break
else:
rounds = 0
error = 1
if money <= 5:
print("Game Over!")
again = input("Play Again? (Y or N)")
if again == "N" or again == "n":
play = False
break
if again == "Y" or again == "y":
os.system(__file__)
if play == 0:
true_score = float(format(money_score, '.2f'))
os.system('cls')
print("Scores")
print("----------------------")
print("Goods Left: ", goods)
print("Goods Sold: ", score-goods)
print("----------------------")
print("Time Spent: ", year, "Year(s) | ", day, "Day(s)")
print("Tax set to: ", float(tax * 100), "%")
print("----------------------")
print("Price for per Good sold: $", cost)
print("Money Collected: $", format(money_score, '.2f'))
print("Money Spent: $", score*5-(250*rent))
print("True Money Score: $", format(true_score - (score * 5), '.2f'))
print("----------------------")
print("")
again = input("Play Again? (Y or N)")
if again == "Y" or again == "y":
os.system(__file__)
if again == "N" or again == "n":
play = False
break