-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathZooscape 0-1-1.py
341 lines (281 loc) · 12.3 KB
/
Zooscape 0-1-1.py
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
import animal_name_gen
import random
import os
from datetime import datetime
import sys
animal_name_file = open("./animal_name.txt")
animal_list = []
for line in animal_name_file:
newline = line.replace("\n",'')
animal_list.append(newline)
animal_name_file.close()
codes = [
"HALBERT",
"ZILLA",
"THANKS",
"PROMOBABIRUSA"
]
animal_list = sorted(animal_list)
screen = "homescreen"
animals = []
ages = []
species = []
time_acquired = []
now = datetime.now()
shop_animals = []
shop_ages = []
shop_species = []
shop_cost = []
shop_data = []
shopagain = False
balance = 10000000
myZoo = [["n/a", "n/a", "n/a", "n/a"], ["n/a", "n/a", "n/a", "n/a"], ["n/a", "n/a", "n/a", "n/a"], ["n/a", "n/a", "n/a", "n/a"]]
available_animals = []
available_ages = []
available_species = []
idc = -1
#idc means id code
coordinate_x = 0
coordinate_y = 0
animal_name_gen.generate_animal_name()
def gen_anim():
return animal_list[random.randint(0, len(animal_list)-1)]
def gen_shop():
if inp != "order species":
for namegen in range(random.randint(20, 300)):
shop_animals.append(animal_name_gen.generate_animal_name())
shop_ages.append(str(random.randint(1, 22)))
shop_species.append(gen_anim())
shop_cost.append(str(random.randint(30000, 2000000))) #30,000 and 2,000,000
else:
return None
while True:
if screen == "homescreen":
print("Zooscape 0.1.1".center(100," "))
print()
print("Press [Enter] to play!".center(100," "))
inp = input()
screen = "play"
if screen == "play":
print("Welcome to Zooscape!\n\n")
if animals == []:
print("You have no animals. Enter 'shop' to view animals on sale!")
print("Type other commands to go to other pages, now limited to you.")
print("You will see more when you have animals. ")
print("'codes' will let you enter codes")
print("'animal book' will show your animal book directory")
print("'shop' to view animals on sale")
print("'exit' to exit the game")
inp = input()
if inp == "shop":
screen = "shop"
if inp == "animal book":
screen = "animal book"
if inp == "codes":
screen = "codes"
else:
print("There are many things to do in the zoo. Here are some of them")
print("'shop' to view animals on sale")
print("'zoo' will show your zoo")
print("'codes' will let you enter codes")
print("'animal book' will show your animal book directory")
inp = input()
if inp == "shop":
screen = "shop"
if inp == "zoo":
screen = "zoo"
if inp == "animal book":
screen = "animal book"
if inp == "codes":
screen = "codes"
if inp == "exit":
quit()
if screen == "shop":
gen_shop()
if shop_animals == []:
print("Sorry, we do not have any animals. Try again later.".center(100," "))
print()
screen = "homescreen"
else:
if shopagain == False: #new time
print("Welcome to the Animal Shop!".center(100," "))
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~".center(100," "))
print()
print("You can do many things in shop. Here are the commands!")
print("(buy item when asked) will get you an animal of your choice.")
print("'order species' would order them by species. ")
print("\n\nYou have $",("{:,}".format(int(balance))))
else: #old time
clear_screen()
for i in range(len(shop_animals)):
print("ID " + str(i) + ": " + (shop_animals[i]) + " (" + (shop_ages[i]) + " year old " + (shop_species[i]) + ") for $" + ("{:,}".format(int(shop_cost[i]))))
print("What would'tchu like? Gimme the ID, please.")
inp = input()
clear_screen()
if inp != "" or " ":
if inp == "order species":
ordered_by_species = sorted(zip(shop_animals, shop_ages, shop_species), key=lambda x: x[2])
shop_animals, shop_ages, shop_species = zip(*ordered_by_species)
print("Animals ordered by species!")
shopagain = True
elif int(inp) >= 0 and int(inp) < len(shop_animals):
print("OK! I'll get it for ya.")
animals.append(shop_animals[int(inp)])
available_animals.append(shop_animals[int(inp)])
ages.append(shop_ages[int(inp)])
available_ages.append(shop_ages[int(inp)])
species.append(shop_species[int(inp)])
available_species.append(shop_species[int(inp)])
balance -= int(shop_cost[int(inp)])
idc += 1
print("ID " + str(idc) + ": " + (animals[idc]) + " (" + (ages[idc]) + ") is your very own " + (species[idc]) + "!")
print("\n\nYou have $",("{:,}".format(int(balance))))
date_time = now.strftime("%m/%d/%Y, %H:%M:%S")
time_acquired.append(date_time)
shop_animals = list(shop_animals)
shop_ages = list(shop_ages)
shop_species = list(shop_species)
shop_animals.pop(int(inp))
shop_ages.pop(int(inp))
shop_species.pop(int(inp))
print("Anything else? (yes/no)")
inp = input()
if inp == "yes":
screen = "shop"
shopagain = True
else:
print("Come again!")
screen = "play"
else:
print("I can't find them. Maybe try again?")
if screen == "zoo":
for row in range(len(myZoo)):
for column in range(len(myZoo[0])):
print("[" + myZoo[row][column], end = "]\t\t")
print()
print()
print("Do you want to add anything?")
inp = input()
if inp == "yes":
print("Here are your animals:")
for i in range(len(available_animals)):
print("ID " + str(i) + " " + available_animals[i] + " (" + available_ages[i] + "-year old " + available_species[i] + ")")
inp = int(input("Which one to put? Give me the ID. \n"))
find = inp
# Check if the selected species matches the available species
selected_species = available_species[find]
matching_indices = [i for i, species in enumerate(available_species) if species == selected_species]
if matching_indices:
print("Now for the coordinates. ")
coordinate_x, coordinate_y = map(int, input().split())
if coordinate_x <= 0:
coordinate_x = 1
if coordinate_y <= 0:
coordinate_y = 1
print("Loading...")
if myZoo[coordinate_x-1][coordinate_y-1] == "n/a":
myZoo[coordinate_y-1][coordinate_x-1] = available_animals[find]
available_animals.pop(find)
available_ages.pop(find)
available_species.pop(find)
else:
print("Sorry, that's occupied.")
screen = "homescreen"
screen = "zoo"
for row in range(len(myZoo)):
for column in range(len(myZoo[0])):
print("[" + myZoo[row][column], end = "]\t\t")
print()
print()
print("More to add?")
inp = input()
if inp == "yes":
screen = "homescreen"
else:
print("Okay, you will be brought back to the shop!")
screen = "shop"
else:
print("Sorry, there are no available animals of the same species.")
print("You will be brought back to the shop!")
screen = "shop"
else:
print("Okay, you will be brought back to the shop!")
screen = "shop"
if screen == "animal book":
print("Welcome to the Animal Book!")
print("To see all available animals, type 'continue'. To see your animals, type 'my animal book'.")
inp = input()
if inp == "continue":
print("Here are all " + str(len(animal_list)) + " available species!\n")
for i in range(len(animal_list)):
if animal_list[i] in species:
print(animal_list[i] + " is either in your zoo or is available to put there.")
if animal_list[i] not in species:
print(animal_list[i] + " is yet to be bought.")
else:
screen = "my animal book"
if screen == "my animal book":
print("Here are your personal animals")
for i in range(len(animals)):
print("ID " + str(i) + " " + animals[i] + ", " + ages[i] + "-year old " + species[i])
print("Give an ID number and you will get data on the animal. To exit, type exit twice. ")
inp = input()
if inp == "exit":
screen = "play"
else:
print("----------------------------------------------------------------------------------------")
print(animals[int(inp)] + " (" + ages[int(inp)] +")\n" + species[int(inp)])
print("This specimen was acquired on " + time_acquired[int(inp)] + ".")
if animals[int(inp)] in available_animals:
print("This specimen is available to put in your zoo. ")
else:
print("It's probably in your zoo. ")
print("----------------------------------------------------------------------------------------")
if screen == "codes":
print("WELCOME TO CODES")
print("Enter a code to get your reward!")
print("Type 'help' for help!")
inp = input()
if inp == "help":
print("Welcome to the Codes Help Page!")
print("For questions on how to use, type '1'. ")
inp = input()
break
if inp == "exit":
screen = "homescreen"
inp = inp.upper()
print(inp)
if inp in codes:
if inp == "HALBERT":
print("The original guy. ")
animals.append("Halbert")
species.append("Mountain Goat")
ages.append("12")
date_time = now.strftime("%m/%d/%Y, %H:%M:%S")
time_acquired.append(date_time)
print("You have acquired Halbert (12-year old Mountain Goat)!")
elif inp == "ZILLA":
print("He's just a gila monster.")
animals.append("Zilla")
species.append("Gila Monster")
ages.append("5")
date_time = now.strftime("%m/%d/%Y, %H:%M:%S")
time_acquired.append(date_time)
print("You have acquired Zilla (12-year old Gila Monster)!")
elif inp == "THANKS":
print("You're welcome!")
print("You recived 100 dollars. ")
balance += 100
elif inp == "PROMOBABIRUSA":
print("Here's a little babirusa for you!")
animals.append("Sunday")
species.append("Sulawesian Babirusa")
ages.append("19")
date_time = now.strftime("%m/%d/%Y, %H:%M:%S")
time_acquired.append(date_time)
print("You have acquired Sunday (19-year old Sulawesian Babirusa)!")
else:
print("Sorry, that is not a valid code. ")
if screen == "exit":
print("Goodbye!")
quit()