Skip to content

Commit f7f3672

Browse files
authored
Update main.py
1 parent 00cc50b commit f7f3672

File tree

1 file changed

+55
-27
lines changed

1 file changed

+55
-27
lines changed

main.py

+55-27
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@
1010
###################################
1111

1212
import random
13-
import time
13+
from playsound import playsound
14+
import time as t
1415
import os
1516

1617

1718
def choose_discrepency(discrepency_present):
18-
'''This function lets you choose which data to verify.'''
1919
possible_choices_1 = ["Y", "N"]
20-
possible_choices_2 = ["NAME", "GENDER", "DOB", "EXP", "EXIT"]
20+
possible_choices_2 = ["NAME", "GENDER", "DOB", "EXP", "EXIT", "NAT"]
2121
discrepency_choice = input("Do you want to check for discrepencies? [Y/N]").upper()
2222
while discrepency_choice not in possible_choices_1:
2323
discrepency_choice = input("Incorrect input, choose Y (yes) or N (no).").upper()
2424
if discrepency_choice == "Y":
2525
print("Type exit to exit the discrepency menu.")
26-
parameter = input("Which parameter would you like to check? [NAME/GENDER/DOB/EXP].").upper()
26+
parameter = input("Which parameter would you like to check? [NAME/GENDER/DOB/EXP/NAT].").upper()
2727
while parameter != "EXIT":
2828
while parameter not in possible_choices_2:
2929
parameter = input("Incorrect input, choose NAME, GENDER, DOB or EXP.").upper()
@@ -42,9 +42,7 @@ def choose_discrepency(discrepency_present):
4242

4343

4444
def check_discrepency(person, date):
45-
'''This function checks if there are any discrepencies present.'''
4645
if date[2] > person["expire"][2]:
47-
print("year bad")
4846
return True
4947
if date[2] == person["expire"][2]:
5048
if date[1] > person["expire"][1]:
@@ -56,11 +54,9 @@ def check_discrepency(person, date):
5654

5755

5856
def clear():
59-
os.system('cls') #Windows clear command
60-
#os.system('clear') #Unix clear command, uncomment to use.
57+
os.system('cls')
6158

6259
def passport_display(data):
63-
'''This function displays the passport of a person.'''
6460
dateofbirth = str(data['dob'][0]) + "/" + str(data['dob'][1]) + "/" + str(data['dob'][2])
6561
expirydate = str(data['expire'][0]) + "/" + str(data['expire'][1]) + "/" + str(data['expire'][2])
6662
print('''---------------------------------------------------------
@@ -70,13 +66,12 @@ def passport_display(data):
7066
@@@@@@@@@@@@ | GENDER: {}
7167
@@@@@@@@@ | DATE OF BIRTH: {}
7268
@@@@@@ | EXPIRY DATE: {}
73-
@@@@@@ |
69+
@@@@@@ | NATIONALITY: {}
7470
@@@@@@@@@@@@@@@@@@ |
7571
@@@@@@@@@@@@@@@@@@@@@@@@ |
76-
---------------------------------------------------------'''.format(data["name"], data["gender"], dateofbirth,expirydate))
72+
---------------------------------------------------------'''.format(data["name"], data["gender"], dateofbirth,expirydate, data["nationality"].upper()))
7773

7874
def expire_date():
79-
'''Generates a random expiry date.'''
8075
month_length = {1: 31, 3: 31, 4: 30, 5: 31, 6: 30, 7: 31, 8: 31, 9: 30, 10: 31, 11: 30, 12: 31}
8176
year = random.randint(1981, 1988)
8277
month = random.randint(1, 12)
@@ -169,16 +164,16 @@ def choose_full_name_gender():
169164
return (full_name, gender)
170165

171166
def generate_person():
172-
'''Combines every generation function to create a person's passport.'''
167+
countries = ["Arstotzka", "Antegria", "Impor", "Kolechia", "Obristan", "Republia", "United Federation"]
173168
name, gender = choose_full_name_gender()
174169
dob = choose_birthdate()
175170
weight = random.randint(57, 93)
176171
height = random.randint(160, 195)
177172
expire = expire_date()
178-
return {"name" : name, "gender" : gender, "dob" : dob, "weight" : weight, "height" : height,"expire" : expire}
173+
nationality = countries[random.randint(0, 6)]
174+
return {"name" : name, "gender" : gender, "dob" : dob, "weight" : weight, "height" : height,"expire" : expire, "nationality" : nationality}
179175

180176
def approve_deny(discrepency_present):
181-
'''This function handles approval and denial of a person's entry.'''
182177
possible_choices = ["APPROVE", "DENY"]
183178
approve = input("Do you want to [APPROVE] or [DENY] entry to this person?").upper()
184179
while approve not in possible_choices:
@@ -193,20 +188,53 @@ def approve_deny(discrepency_present):
193188
print("You have gotten a citation! No discrepencies were present!")
194189

195190

191+
def menu():
192+
print('''
193+
____ ___
194+
| _ \ / _ \
195+
| |_) |_ ___ ____ _| | | | ________________
196+
| _ <| | | \ \/ /\ \/ / | | | |github.com/Buxx0|
197+
| |_) | |_| |> < > <| |_| | ----------------
198+
|____/ \__,_/_/\_\/_/\_\\\___/ Papers, Please.py
199+
''')
200+
t.sleep(3)
201+
clear()
202+
print("Please support the release of Papers, Please on steam, iOS and Android.")
203+
print("And it's creator, LUCAS POPE.")
204+
t.sleep(3)
205+
clear()
206+
207+
196208
def play():
197-
'''Main function.'''
198-
todaysdate = (10,11,1982)
199-
count = 0
200-
while count != -1:
201-
person = generate_person()
202-
passport_display(person)
203-
print("Today's date is: {}/{}/{}".format(todaysdate[0],todaysdate[1],todaysdate[2]))
204-
discrepency_present = check_discrepency(person, todaysdate)
205-
choose_discrepency(discrepency_present)
206-
approve_deny(discrepency_present)
207-
input("Press enter to call in the next person.")
209+
month_length = {1: 31, 3: 31, 4: 30, 5: 31, 6: 30, 7: 31, 8: 31, 9: 30, 10: 31, 11: 30, 12: 31}
210+
menu()
211+
todaysdate = [10,11,1982]
212+
while todaysdate != [31, 2, 1983]:
213+
clear()
214+
count = 0
215+
maximum = random.randint(8, 14)
216+
while count != maximum:
217+
person = generate_person()
218+
passport_display(person)
219+
print("Today's date is: {}/{}/{}".format(todaysdate[0],todaysdate[1],todaysdate[2]))
220+
discrepency_present = check_discrepency(person, todaysdate)
221+
choose_discrepency(discrepency_present)
222+
approve_deny(discrepency_present)
223+
input("Press enter to call in the next person.")
224+
clear()
225+
count += 1
226+
if todaysdate[0] == month_length[todaysdate[1]]:
227+
if todaysdate[1] != 12:
228+
todaysdate[1] += 1
229+
else:
230+
todaysdate[1] = 1
231+
todaysdate[2] += 1
232+
else:
233+
todaysdate[0] += 1
208234
clear()
209-
count += 1
235+
print("The border closes for the day, and you walk home.")
236+
t.sleep(3)
210237

211238

239+
playsound("papers.mp3", False)
212240
play()

0 commit comments

Comments
 (0)