10
10
###################################
11
11
12
12
import random
13
- import time
13
+ from playsound import playsound
14
+ import time as t
14
15
import os
15
16
16
17
17
18
def choose_discrepency (discrepency_present ):
18
- '''This function lets you choose which data to verify.'''
19
19
possible_choices_1 = ["Y" , "N" ]
20
- possible_choices_2 = ["NAME" , "GENDER" , "DOB" , "EXP" , "EXIT" ]
20
+ possible_choices_2 = ["NAME" , "GENDER" , "DOB" , "EXP" , "EXIT" , "NAT" ]
21
21
discrepency_choice = input ("Do you want to check for discrepencies? [Y/N]" ).upper ()
22
22
while discrepency_choice not in possible_choices_1 :
23
23
discrepency_choice = input ("Incorrect input, choose Y (yes) or N (no)." ).upper ()
24
24
if discrepency_choice == "Y" :
25
25
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 ()
27
27
while parameter != "EXIT" :
28
28
while parameter not in possible_choices_2 :
29
29
parameter = input ("Incorrect input, choose NAME, GENDER, DOB or EXP." ).upper ()
@@ -42,9 +42,7 @@ def choose_discrepency(discrepency_present):
42
42
43
43
44
44
def check_discrepency (person , date ):
45
- '''This function checks if there are any discrepencies present.'''
46
45
if date [2 ] > person ["expire" ][2 ]:
47
- print ("year bad" )
48
46
return True
49
47
if date [2 ] == person ["expire" ][2 ]:
50
48
if date [1 ] > person ["expire" ][1 ]:
@@ -56,11 +54,9 @@ def check_discrepency(person, date):
56
54
57
55
58
56
def clear ():
59
- os .system ('cls' ) #Windows clear command
60
- #os.system('clear') #Unix clear command, uncomment to use.
57
+ os .system ('cls' )
61
58
62
59
def passport_display (data ):
63
- '''This function displays the passport of a person.'''
64
60
dateofbirth = str (data ['dob' ][0 ]) + "/" + str (data ['dob' ][1 ]) + "/" + str (data ['dob' ][2 ])
65
61
expirydate = str (data ['expire' ][0 ]) + "/" + str (data ['expire' ][1 ]) + "/" + str (data ['expire' ][2 ])
66
62
print ('''---------------------------------------------------------
@@ -70,13 +66,12 @@ def passport_display(data):
70
66
@@@@@@@@@@@@ | GENDER: {}
71
67
@@@@@@@@@ | DATE OF BIRTH: {}
72
68
@@@@@@ | EXPIRY DATE: {}
73
- @@@@@@ |
69
+ @@@@@@ | NATIONALITY: {}
74
70
@@@@@@@@@@@@@@@@@@ |
75
71
@@@@@@@@@@@@@@@@@@@@@@@@ |
76
- ---------------------------------------------------------''' .format (data ["name" ], data ["gender" ], dateofbirth ,expirydate ))
72
+ ---------------------------------------------------------''' .format (data ["name" ], data ["gender" ], dateofbirth ,expirydate , data [ "nationality" ]. upper () ))
77
73
78
74
def expire_date ():
79
- '''Generates a random expiry date.'''
80
75
month_length = {1 : 31 , 3 : 31 , 4 : 30 , 5 : 31 , 6 : 30 , 7 : 31 , 8 : 31 , 9 : 30 , 10 : 31 , 11 : 30 , 12 : 31 }
81
76
year = random .randint (1981 , 1988 )
82
77
month = random .randint (1 , 12 )
@@ -169,16 +164,16 @@ def choose_full_name_gender():
169
164
return (full_name , gender )
170
165
171
166
def generate_person ():
172
- '''Combines every generation function to create a person's passport.'''
167
+ countries = [ "Arstotzka" , "Antegria" , "Impor" , "Kolechia" , "Obristan" , "Republia" , "United Federation" ]
173
168
name , gender = choose_full_name_gender ()
174
169
dob = choose_birthdate ()
175
170
weight = random .randint (57 , 93 )
176
171
height = random .randint (160 , 195 )
177
172
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 }
179
175
180
176
def approve_deny (discrepency_present ):
181
- '''This function handles approval and denial of a person's entry.'''
182
177
possible_choices = ["APPROVE" , "DENY" ]
183
178
approve = input ("Do you want to [APPROVE] or [DENY] entry to this person?" ).upper ()
184
179
while approve not in possible_choices :
@@ -193,20 +188,53 @@ def approve_deny(discrepency_present):
193
188
print ("You have gotten a citation! No discrepencies were present!" )
194
189
195
190
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
+
196
208
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
208
234
clear ()
209
- count += 1
235
+ print ("The border closes for the day, and you walk home." )
236
+ t .sleep (3 )
210
237
211
238
239
+ playsound ("papers.mp3" , False )
212
240
play ()
0 commit comments