-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathThe Nice Neighbors Game
893 lines (893 loc) · 34.8 KB
/
The Nice Neighbors Game
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
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "1459eb20",
"metadata": {
"cell_style": "center",
"code_folding": [],
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Welcome, get ready to start playing\n",
"\n",
" **The Nice Neighbors**\n",
"\n",
" \n",
"Enter your name \n",
"\n",
"Glediy\n",
"What's the name of your favorite person \n",
"\n",
"\n",
"What's your favorite city to visit? \n",
"\n",
"\n",
"In which state or country? \n",
"\n",
"f\n",
"Do you have a cat? yes or no \n",
"\n",
"no\n",
"if you had a pet, what would you name it?\n",
"\n",
" tuy\n"
]
}
],
"source": [
"import random\n",
"\n",
"#Welcoming player to the game\n",
"print(\"\"\"\n",
"Welcome, get ready to start playing\n",
"\n",
" **The Nice Neighbors**\n",
"\n",
" \"\"\")\n",
"\n",
"#the following code ask information about the player which will be \n",
"# use for dynamic strings\n",
"\n",
"#defining player variable\n",
"player_name = input(prompt = \"\"\"Enter your name \\n\n",
"\"\"\")\n",
"\n",
"#defining variable\n",
"favorite_person = input(prompt = \"\"\"What's the name of your favorite person \\n\n",
"\"\"\")\n",
"\n",
"#defining variable\n",
"city = input(prompt= \"\"\"What's your favorite city to visit? \\n\n",
"\"\"\")\n",
"\n",
"#defining variable\n",
"stateORcountry = input(prompt = \"\"\"In which state or country? \\n\n",
"\"\"\")\n",
"\n",
"#defining variable\n",
"pet = input(prompt = \"\"\"Do you have a cat? yes (1) or no (2) \\n\n",
"\"\"\")\n",
"\n",
"#converting pet variable to case sentsitive\n",
"pet = pet.casefold()\n",
"\n",
"if pet in \"yes\" or \"1\" in pet:\n",
" pet_kind = input(prompt = \"\"\"what kind of pet? ex. dog, cat\\n\n",
" \"\"\")\n",
" pet_name = input(prompt = \"\"\"what's your pet's name?\\n\n",
" \"\"\")\n",
"else:\n",
" pet_name = input(prompt =\"\"\"if you had a pet, what would you name it?\\n\n",
" \"\"\")\n",
"\n",
"#Defining start()\n",
"def start():\n",
" \n",
"#Defining variable choice with input \n",
" choice = input(prompt = \n",
"f\"\"\"\n",
"**********************************************************************\n",
"{favorite_person} and you live in {city}, {stateORcountry} \n",
"with the white picket fence, the good schools, and the nice\n",
"neighbors, with your {pet_kind} {pet_name}.\n",
"\n",
"One night, around 10pm, while you are reading on your porch, you hear \n",
"screaming coming from your neighbor's house across the street. It looks\n",
"like they are fighting but you cant really tell - and you know them to be \n",
"nice people who never fight... So what would you?\n",
"\n",
"1. Call the police\n",
"2. Go and check on them\n",
"\n",
"**********************************************************************\n",
" \"\"\")\n",
"\n",
"# converting choice using .casefold()\n",
" choice = choice.casefold()\n",
"\n",
"# extending choice with conditional\n",
" if choice in 'call the police' or '1'in choice:\n",
" room = random.randint(1,3) #randomizing game path using conditional statement\n",
" #defining game path using conditional statement\n",
" if room == 1:\n",
" room1()\n",
" elif room == 2:\n",
" win()\n",
" elif room == 3:\n",
" win1()\n",
" else:\n",
" input(prompt='Something Went Wrong.Press enter to go back')\n",
" start()\n",
"\n",
" elif choice in 'go and check on them' or '2'in choice:\n",
" room = random.randint(1,4) #randomizing game path using conditional statement\n",
" #defining game path using conditional statement\n",
" if room == 1:\n",
" fail1()\n",
" elif room == 2:\n",
" fail2()\n",
" elif room == 3:\n",
" fail()\n",
" elif room == 4:\n",
" room2()\n",
" else:\n",
" input(prompt='Something Went Wrong.Press enter to go back')\n",
" start()\n",
" else:\n",
" input(prompt = '\\nSomething went wrong.Press enter to go back')\n",
" start()\n",
" \n",
"#Defining room1()\n",
"def room1():\n",
"#Defining dinner_inv with input\n",
" dinner_inv = input(prompt = f\"\"\"\n",
"\n",
"Minutes later the police arrive, but after a while they leave and \n",
"nothing happened. \n",
"\n",
"Two day later, your neighbors invite you over for dinner\n",
"Would you like to go\n",
"\n",
"1. Yes\n",
"2. No\n",
" \n",
" \"\"\")\n",
"#convering dinner_inv to case sensitive with .casefold() \n",
" dinner_inv = dinner_inv.casefold()\n",
" \n",
"#Extending dinner_inv with nested conditional statement \n",
" if dinner_inv in \"yes\" or '1' in dinner_inv:\n",
" #defining dinner gift variable with input statement\n",
" dinner_gift = input(prompt = \"\"\"\n",
"Would you like to bring a gift\n",
" \n",
"1. Yes\n",
"2. No \n",
" \"\"\")\n",
" \n",
" #converting dinner_gift to case sensitive with .casefold()\n",
" dinner_gift = dinner_gift.casefold()\n",
" if dinner_gift in 'yes' or '1' in dinner_gift:\n",
" input(prompt = \"What would you like to bring?\")\n",
" print(\"Nice Choice!\")\n",
" elif dinner_gift in 'no' or '2' in dinner_gift: \n",
" print(\"That's kind of rude, but lets continue.\")\n",
" else:\n",
" input(prompt = \"Invalid entry.Press enter to go back.\")\n",
" room1()\n",
" #Moving into dinner scenario within nested conditional statement \n",
" input(prompt = \"Press enter to continue\")\n",
" #Dinner scenario story \n",
" print(f\"\"\"\n",
"It's 6pm and you and your husband/wife make your way to the neighbor's \n",
"place, you ring the bell.They look normal and thank you for your{dinner_gift}\n",
"and invite you in.\n",
"\n",
"You asked to go to the bathroom to wash your hand before dinner. Everyone is \n",
"distracted downstairs by your husband/wife's charms, so you decide to do \n",
"some snooping, and decide to open the door at the end of the hall. It was \n",
"empty, there was nothing but a chair, and a table.\n",
"\n",
"Suddenly, the wife its behind you!!!! You scared by her and say:\n",
"\"Sorry, I was looking for the bathroom I must've gotten lost.\n",
"\n",
"The Wife: laugh nervously, and says \"the bathroom is that way, try to not \n",
"keep snoop in places you don't belong...\n",
" \n",
" \"\"\")\n",
" #defining choice_1 variable within nested conditional statement\n",
" choice_1 = input(prompt = f\"\"\"\n",
"After using the bathroom, you go downstairs and…\n",
"\n",
"1. Stay for dinner\n",
"2. Make an excuse and leave early\n",
"3. Ask her what the room supposed to be\n",
"\n",
" \"\"\")\n",
" #nested conditional statement based on dinner scenario story/choice_1\n",
" if choice_1 in 'stay for dinner' or '1' in choice_1:\n",
" print(f\"\"\"\n",
"The next morning, you see moving truck in front of your neighbor's\n",
"house, you go check and you noticed they are moving out, so abruptly. \n",
"One year later you find out that they move to another suburban city \n",
"where they were arrested for kidnapping their neighbors. \n",
"\n",
"WIN: YOU ARE LUCKY THAT COULD'VE BEEN YOU!\n",
"\n",
" \"\"\")\n",
" #winning scenario: prompting the user to play again\n",
" input(prompt = \"Would you like to play again? Press enter\")\n",
" start()\n",
" #Player loses, based on dinner scenario story/choice_1\n",
" elif choice_1 in 'make an excuse and leave early' or '2' in choice_1:\n",
" room = random.randint(1,3) #randomizing game path using conditional statement\n",
" #defining game path using conditional statement\n",
" if room == 1:\n",
" fail()\n",
" elif room == 2:\n",
" win()\n",
" elif room == 3:\n",
" win1()\n",
" else:\n",
" input(prompt='Something Went Wrong.Press enter to go back')\n",
" room1()\n",
" #Player is take to next game scenario\n",
" elif choice_1 in'ask her what the room suppose to be'or'3'in choice_1:\n",
" room = random.randint(1,3) #randomizing game path using conditional statement\n",
" #defining game path using conditional statement\n",
" if room == 1:\n",
" room3()\n",
" elif room == 2:\n",
" fail1()\n",
" elif room == 3:\n",
" fail2()\n",
" else:\n",
" input(prompt='Something Went Wrong.Press enter to go back')\n",
" room1()\n",
" #Player goes back to room1(), in case of invalid entry\n",
" else:\n",
" input(prompt = 'Invalid Entry. Press enter to go back.')\n",
" room1() \n",
"#Winning scenario based on dinner_inv user input\n",
" elif dinner_inv in 'no' or '2' in dinner_inv:\n",
" print(\"\"\"\n",
"The next morning, you see moving truck in front \n",
"of your neighbor's house, you go check and you noticed \n",
"they are moving out, so abruptly. One year later you \n",
"find out that they move to another suburban city \n",
"where they were arrested for kidnapping their neighbors. \n",
"\n",
"WIN: YOU ARE LUCKY THAT COULD'VE BEEN YOU!\n",
"\n",
"\"\"\")\n",
" #prompting the user to start again\n",
" input(prompt = \"Would you like to play again? Press enter\")\n",
" start()\n",
"#end of nested conditional statement; prompting player to go back in case of invalid entry\n",
" else:\n",
" input(prompt = \"Invalid Entry. Press enter to go back.\")\n",
" room1()\n",
"#defining room2()\n",
"def room2():\n",
" #defining question variable\n",
" question = input(prompt = f\"\"\"\n",
"They both open the door, ask you \"How can we help you\". The wife \n",
"looks distressed and the husband's hands are cover in bruises. \n",
"What would you ask or do?\n",
"\n",
"1. What happen to your hand?\n",
"2. I heard a scream, is everything ok?\n",
"3. Talk About something else and snoop inside?\n",
"\n",
" \"\"\")\n",
" #converting question to case sensitive with .casefold() \n",
" question = question.casefold()\n",
" #extending question with nested conditional statement\n",
" if question in 'what happen to your hand' or '1' in question:\n",
" #defining answer variable\n",
" answer = input(prompt = f\"\"\" \n",
"Husband: 'I cut myself while cooking :)\n",
"Would you take that for an answer?\n",
" \n",
"1. Yes, it's late and I have an early morning\n",
"2. No, they are acting weird\n",
" \"\"\")\n",
" #converting answer to case sensitive with .casefold()\n",
" answer = answer.casefold()\n",
" #extending 'answer' variable with nested conditional statement\n",
" if answer in\"yes, it's late and I have an early morning\"or\"1\"in answer:\n",
" print(\"\"\"\n",
"The next morning you see them carrying a duffel bag. The notice you looking \n",
"at them and wave to you with a creepy smile. The next morning the are on the \n",
"news for kidnapping their neighbors.\n",
"\n",
"WIN:YOUR ARE LUCKY, THAT COULD'VE BEE YOU\n",
" \n",
" \"\"\")\n",
" elif answer in 'no, they are acting weird' or \"2\" in answer:\n",
" room = random.randint(1,3) #randomizing game path using conditional statement\n",
" #defining game path using conditional statement\n",
" if room == 1:\n",
" fail()\n",
" elif room == 2:\n",
" fail1()\n",
" elif room == 3:\n",
" fail2()\n",
" else:\n",
" input(prompt='Something Went Wrong.Press enter to go back')\n",
" room2()\n",
" else:\n",
" input(prompt = 'Invalid Entry. Press enter to go back')\n",
" room2()\n",
" \n",
" elif question in 'I heard a scream, is everything ok' or '2' in question:\n",
" #defining answer_2 \n",
" answer_1 = input(prompt = f\"\"\"\n",
"Both smile in a creepy way and say 'Everything is Great!, you should go home\"\n",
"and close the door.\n",
"\n",
"What would you like to do?\n",
" \n",
"1. Leave, it's too late\n",
"2. Keep asking question, to get to the truth\n",
"3. Call the police\n",
" \n",
" \"\"\") \n",
" #converting answer_1 to case sensitive with .casefold() \n",
" answer_1 = answer_1.casefold()\n",
" #extending answer_1 with conditional statement\n",
" if answer_1 in \"leave, it's too late\" or '1' in answer_1:\n",
" print(\"\"\"\n",
"The next morning you see them carrying a duffel bag. The notice you looking \n",
"at them and wave to you with a creepy smile. The next morning the are on the \n",
"news for kidnapping their neighbors.\n",
"\n",
"WIN:YOUR ARE LUCKY, THAT COULD'VE BEE YOU\n",
" \n",
" \"\"\")\n",
" elif answer_1 in'keep asking questions, to get to the truth'or'2'in answer_1:\n",
" room = random.randint(1,4) #randomizing game path using conditional statement\n",
" #defining game path using conditional statement\n",
" if room == 1:\n",
" fail()\n",
" elif room == 2:\n",
" fail1()\n",
" elif room == 3:\n",
" fail2()\n",
" elif room == 4:\n",
" win()\n",
" else:\n",
" input(prompt='Something Went Wrong.Press enter to go back')\n",
" room2()\n",
" \n",
" elif answer_1 in 'call the police' or '3' in answer_1:\n",
" room = random.randint(1,4) #randomizing game path using conditional statement\n",
" #defining game path using conditional statement\n",
" if room == 1:\n",
" fail()\n",
" elif room == 2:\n",
" win1()\n",
" elif room == 3:\n",
" win()\n",
" elif room == 4:\n",
" room1()\n",
" else:\n",
" input(prompt='Something Went Wrong.Press enter to go back')\n",
" room2()\n",
" else:\n",
" input(prompt = \"Invalid Entry. Press enter to go back\")\n",
" room2()\n",
" \n",
" elif question in'talk about something else, and snoop inside' or'3'in question:\n",
" input(prompt = \"\"\"\n",
"What would you like to talk about?\n",
"\n",
"\"\"\")\n",
" input(prompt = \"\"\"\n",
"I don't think that would distract them, but let's see what happens.\n",
"Press enter to continue\n",
" \"\"\")\n",
" room = random.randint(1,3) #randomizing game path using conditional statement\n",
" #defining game path using conditional statement\n",
" if room == 1:\n",
" fail1()\n",
" elif room == 2:\n",
" fail2()\n",
" elif room == 3:\n",
" win()\n",
" else:\n",
" input(prompt='Something Went Wrong.Press enter to go back')\n",
" start()\n",
" #end of nested conditional statement: prompting player back to room2() \n",
" else:\n",
" input(prompt = \"Invalid Entry. Press Enter to continue\")\n",
" room2() \n",
" \n",
"#defining room3() \n",
"def room3():\n",
" #defining guess variable with input\n",
" guess = input(prompt = \"\"\"\n",
"The wife has pushed you into the room!!\n",
" \n",
"Guess a number from 1 to 5 and I will tell you what items are inside the room\n",
" \"\"\")\n",
"\n",
"#extending guess with conditional statement\n",
" if guess != \"3\":\n",
" guess_1 = input(prompt = \"\"\"\n",
"I'll give you a hint, it's the root square of 9. Enter the number\n",
" \"\"\")\n",
" if guess_1 == \"3\":\n",
" input( prompt = \"\"\"\n",
"That's correct! Press enter to continue\n",
"\n",
" \"\"\")\n",
" #declaring list\n",
" list = ['One table',\n",
" 'One chair',\n",
" '10 books','A window nailed to the wall',\n",
" 'An air duct with 4 screws'] \n",
" #printing list with loop statement\n",
" for elements in list:\n",
" print (elements)\n",
" else: \n",
" input(prompt = \"Wrong!.Press enter to go back\")\n",
" room3()\n",
" elif guess == \"3\":\n",
" list = ['One table',\n",
" 'One chair','10 books',\n",
" 'A window nailed to the wall',\n",
" 'An air duct with 4 screws'] \n",
" #printing list with loop statement\n",
" for elements in list:\n",
" print (elements)\n",
" input(prompt = \"Press enter to continue\")\n",
" else:\n",
" input(prompt = \"Invalid entry. Press enter to go back\")\n",
" room3()\n",
" #escape scenario setup\n",
" print(\"\"\"\n",
"The air duct that can take you outside, but it has screws, \n",
"and might be difficult to open it without a screw driver. A key is\n",
"hidden inside one of the 10 books. Check your pockets you have some\n",
"items that might help\n",
"\n",
" \"\"\")\n",
" input(prompt = \"Enter 1, to reach into your pocket\\n \")\n",
"#declaring list\n",
" inventory = ['keys', 'credit card', 'lip balm']\n",
"#printing list elements with loop statement\n",
" for elements in inventory:\n",
" print(elements)\n",
"#defining choice_3 variable with input \n",
" choice_3 = input(prompt = \"\"\"\n",
"\n",
"What would you like to do?\n",
"\n",
"1. Find the hidden key inside one of the books\n",
"2. Try and open the air duct\n",
"\n",
" \"\"\")\n",
" #converting choice_3 to case sensitive with .casefold()\n",
" choice_3 = choice_3.casefold()\n",
"#extending choice_3 with nested conditional statement\n",
" if choice_3 in 'find the hidden key inside one of the books' or '1' in choice_3:\n",
" input(prompt = \"Press enter to be given a book\")\n",
" #defining book_choice with random method\n",
" book_choice = random.randint(1, 11)\n",
" #extending on book_choice with conditional statement\n",
" if book_choice == 3: \n",
" print(\"Sorry, not luck in finding the key. You will have to try and open the air duct\")\n",
" input(prompt = 'Press enter to continue')\n",
" room4()\n",
" elif book_choice == 4:\n",
" print(\"Sorry, not luck in finding the key. You will have to try and open the air duct\")\n",
" input(prompt = 'Press enter to continue')\n",
" room4()\n",
" elif book_choice == 7:\n",
" input(prompt = 'You found the key. Press enter to open the door and scape')\n",
" fail3()\n",
" elif book_choice == 2:\n",
" input(prompt = 'You found the key. Press enter to open the door and scape')\n",
" fail3()\n",
" elif book_choice == 5:\n",
" input(prompt = 'You have run out of time, the wife is back and you lost. Press any key to exit')\n",
" elif book_choice == 1:\n",
" input(prompt = 'You have run out of time, the wife is back and you lost. Press any key to exit')\n",
" elif book_choice == 6:\n",
" input(prompt = 'You found the key. Press enter to open the door and scape')\n",
" fail3() \n",
" else:\n",
" input(prompt = \"invalid Entry. Press enter to go back\")\n",
" room3()\n",
" #continuing nested conditional statement\n",
" elif choice_3 in 'try and open the air duct' or '2'in choice_3:\n",
" #printing list element from inventory list\n",
" for elements in inventory:\n",
" print (elements)\n",
" #defining choosing_invent with input\n",
" choosing_invent = input(prompt = \"\"\"\n",
"What would you like to open it with?\n",
"\n",
" \"\"\")\n",
" #Converting variable case sensitive\n",
" choosing_invent = choosing_invent.casefold()\n",
" #Extending choosing_invent with conditional statement for 'credit card'\n",
" if choosing_invent == inventory[1]:\n",
" print (\"Good choice. Hurry and try open\")\n",
" input(prompt = \"Press enter to open\")\n",
" room = random.randint(1,2) #randomizing game path using conditional statement\n",
" #defining game path using conditional statement\n",
" if room == 1:\n",
" fail3()\n",
" elif room == 2:\n",
" fail5()\n",
" else:\n",
" input(prompt='Something Went Wrong.Press enter to go back')\n",
" room2()\n",
" #Extending choosing_invent with conditional statement for 'keys'\n",
" elif choosing_invent == inventory[0]:\n",
" print(\"Nice Choice. Hurry and try to open\")\n",
" input(prompt = \"Press enter to open\")\n",
" room = random.randint(1,3) #randomizing game path using conditional statement\n",
" #defining game path using conditional statement\n",
" if room == 1:\n",
" fail4()\n",
" elif room == 2:\n",
" fail3()\n",
" elif room == 3:\n",
" fail5()\n",
" else:\n",
" input(prompt='Something Went Wrong.Press enter to go back')\n",
" room2()\n",
" #Extending choosing_invent with conditional statement for 'lip balm'\n",
" elif choosing_invent == inventory[2]:\n",
" input(prompt = \"What would you do with that\")\n",
" print(prompt = \"Sure! Press enter to try it out\")\n",
" room = random.randint(1,2) #randomizing game path using conditional statement\n",
" #defining game path using conditional statement\n",
" if room == 1:\n",
" fail5()\n",
" elif room == 2:\n",
" fail3()\n",
" else:\n",
" input(prompt='Something Went Wrong.Press enter to go back')\n",
" room2()\n",
" else:\n",
" input(prompt = \"Something went wrong. Press enter to go back\")\n",
" room3()\n",
" #end of nested conditional statement \n",
" else:\n",
" input(prompt = \"Invalid Entry. Press enter to go back \")\n",
"\n",
"#defining room4()\n",
"def room4():\n",
" #printing elements in inventory list\n",
" for elements in inventory:\n",
" print (elements)\n",
" #defining choosing_invent variable with input\n",
" choosing_invent = input(prompt = \"What would you like to open it with?\")\n",
" #converting choosing_invent to case sensitive\n",
" choosing_invent = choosing_invent.casefold()\n",
" #extending choosing_invent with conditional statement\n",
" if choosing_invent == inventory[1]:\n",
" print (\"Good choice. Hurry and try open\")\n",
" input(prompt = \"Press enter to open\")\n",
" room = random.randint(1,2) #randomizing game path using conditional statement\n",
" #defining game path using conditional statement\n",
" if room == 1:\n",
" fail3()\n",
" elif room == 2:\n",
" fail5()\n",
" else:\n",
" input(prompt='Something Went Wrong.Press enter to go back')\n",
" room4()\n",
" elif choosing_invent == inventory[0]:\n",
" print(\"Nice Choice. Hurry and try to open\")\n",
" input(prompt = \"Press enter to open\")\n",
" room = random.randint(1,3) #randomizing game path using conditional statement\n",
" #defining game path using conditonal statement\n",
" if room == 1:\n",
" fail4()\n",
" elif room == 2:\n",
" fail3()\n",
" elif room == 3:\n",
" fail5()\n",
" else:\n",
" input(prompt='Something Went Wrong.Press enter to go back')\n",
" room4()\n",
" elif choosing_invent == inventory[2]:\n",
" input(prompt = \"What would you do with that\")\n",
" print(prompt = \"Sure! Press enter to try it out\")\n",
" room = random.randint(1,2)\n",
" if room == 1:\n",
" fail5()\n",
" elif room == 2:\n",
" fail3()\n",
" else:\n",
" input(prompt='Something Went Wrong.Press enter to go back')\n",
" room4()\n",
" else:\n",
" input(prompt = \"Invalid Entry. Press enter to go back\")\n",
" room4()\n",
"### All this room \n",
"#Defining fail()\n",
"def fail():\n",
" print(f\"\"\"\n",
"You are back at home and around three am you hear steps, and \n",
"your husband/wife is dead asleep, so you turn the light on your \n",
"nightstands, it's you neighbors, they are standing in \n",
"front of you with knives in their hand, and\n",
"your husband/wife is covered in blood.\n",
"\n",
"LOSER:YOU ARE DEAD\n",
"\n",
" \"\"\")\n",
" #starting the game again\n",
" again = input(prompt = \"\"\"\n",
" \n",
" Would you like to play again.\n",
" Enter 1 for \"\"yes\"\", 2 for \"no\"\n",
" \"\"\" )\n",
" if again == \"1\" or \"yes\":\n",
" start()\n",
" elif again == \"2\" or \"no\":\n",
" print(f\"You'd been exit out. Thank you for playing\")\n",
" else:\n",
" tryagain()\n",
" \n",
" \n",
"#defining fail1() \n",
"def fail1():\n",
" print('''\n",
"The husband drags you by the hand and restrains you\n",
"LOSER: YOU CAN'T SCAPE\n",
" \n",
" ''')\n",
" \n",
" #starting the game again\n",
" again = input(prompt = \"\"\"\n",
" \n",
" Would you like to play again.\n",
" Enter 1 for \"\"yes\"\", 2 for \"no\"\n",
" \"\"\" )\n",
" if again == \"1\" or \"yes\":\n",
" start()\n",
" elif again == \"2\" or \"no\":\n",
" print(f\"You'd been exit out. Thank you for playing\")\n",
" else:\n",
" tryagain()\n",
" \n",
" \n",
"#defining fail2()\n",
"def fail2():\n",
" print('''\n",
"You can see a duffel bad on the floor. \n",
"They notice you saw it!The husband drags you and restrains you.\n",
"LOSER:YOU CAN'T SCAPE\n",
" \n",
" ''')\n",
" #starting the game again\n",
" again = input(prompt = \"\"\"\n",
" \n",
" Would you like to play again.\n",
" Enter 1 for \"\"yes\"\", 2 for \"no\"\n",
" \"\"\" )\n",
" if again == \"1\" or \"yes\":\n",
" start()\n",
" elif again == \"2\" or \"no\":\n",
" print(f\"You'd been exit out. Thank you for playing\")\n",
" else:\n",
" tryagain()\n",
" \n",
"#defining fail3() \n",
"def fail3():\n",
" print(f\"\"\"\n",
"Good Job, you open the air duct and succeeded at escaping,\n",
"but you FAILED you left your husband/wife behind. So selfish!\n",
" \"\"\")\n",
" #starting the game again\n",
" again = input(prompt = \"\"\"\n",
" \n",
" Would you like to play again.\n",
" Enter 1 for \"\"yes\"\", 2 for \"no\"\n",
" \"\"\" )\n",
" if again == \"1\" or \"yes\":\n",
" start()\n",
" elif again == \"2\" or \"no\":\n",
" print(f\"You'd been exit out. Thank you for playing\")\n",
" else:\n",
" tryagain()\n",
" \n",
" \n",
"#defining fail4()\n",
"def fail4():\n",
" print(f\"\"\"\n",
"Bad luck, the card broke. \n",
"YOU AND your husband/wife ARE DEAD!\n",
" \"\"\")\n",
" #starting the game again\n",
" again = input(prompt = \"\"\"\n",
" Would you like to play again. \n",
" Enter 1 for \"\"yes\"\", 2 for \"no\"\n",
"\n",
" \"\"\" )\n",
" if again == \"1\":\n",
" start()\n",
" elif again == \"2\":\n",
" print(f\"You'd been exit out. Thank you for playing\")\n",
" else:\n",
" tryagain()\n",
" \n",
" \n",
"#defining fail5()\n",
"def fail5():\n",
" print(\"They are here, You have been caught and failed to scape\")\n",
" #starting the game again\n",
" again = input(prompt = \"\"\"\n",
" Would you like to play again.\n",
" Enter 1 for \"\"yes\"\", 2 for \"no\"\n",
"\n",
" \"\"\" )\n",
" if again == \"1\":\n",
" start()\n",
" elif again == \"2\":\n",
" print(f\"You'd been exit out. Thank you for playing\")\n",
" else:\n",
" tryagain()\n",
" \n",
" \n",
" \n",
"def win():\n",
" print(\"\"\"\n",
"The next morning you see them carrying a duffel bag. The notice you looking \n",
"at them and wave to you with a creepy smile. The next morning the are on the \n",
"news for kidnapping their neighbors.\n",
"\n",
"WIN:YOUR ARE LUCKY, THAT COULD'VE BEE YOU\n",
" \n",
"\"\"\")\n",
" #starting the game again\n",
" again = input(prompt = \"\"\"\n",
" Would you like to play again.\n",
" Enter 1 for \"\"yes\"\", 2 for \"no\"\n",
"\n",
" \"\"\" )\n",
" if again == \"1\" or \"yes\":\n",
" start()\n",
" elif again == \"2\" or \"no\":\n",
" print(f\"You'd been exit out. Thank you for playing\")\n",
" else:\n",
" tryagain()\n",
" \n",
" \n",
" \n",
"def win1():\n",
" print(\"\"\"\n",
"The next morning, you see moving truck in front \n",
"of your neighbor's house, you go check and you noticed \n",
"they are moving out, so abruptly. One year later you \n",
"find out that they move to another suburban city \n",
"where they were arrested for kidnapping their neighbors. \n",
"\n",
"WIN: YOU ARE LUCKY THAT COULD'VE BEEN YOU!\n",
"\n",
"\"\"\")\n",
" #starting the game again\n",
" again = input(prompt = \"\"\"\n",
" Would you like to play again. Press Enter.\n",
" Enter 1 for \"\"yes\"\", 2 for \"no\"\n",
"\n",
" \"\"\" )\n",
" if again == \"1\":\n",
" start()\n",
" elif again == \"2\":\n",
" print(f\"You'd been exit out. Thank you for playing\")\n",
" else:\n",
" tryagain()\n",
"\n",
" \n",
" \n",
"def tryagain():\n",
" print(\"They are here, You have been caught and failed to scape\")\n",
" #starting the game again\n",
" again = input(prompt = \"\"\"\n",
" Would you like to play again.\n",
" Enter 1 for \"\"yes\"\", 2 for \"no\"\n",
"\n",
" \"\"\" )\n",
" if again == \"1\":\n",
" start()\n",
" elif again == \"2\":\n",
" print(f\"You'd been exit out. Thank you for playing\")\n",
" else:\n",
" tryagain()\n",
"\n",
"\n",
"start()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.8"
},
"toc": {
"base_numbering": 1,
"nav_menu": {
"height": "85px",
"width": "188px"
},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
},
"varInspector": {
"cols": {
"lenName": 16,
"lenType": 16,
"lenVar": 40
},
"kernels_config": {
"python": {
"delete_cmd_postfix": "",
"delete_cmd_prefix": "del ",
"library": "var_list.py",
"varRefreshCmd": "print(var_dic_list())"
},
"r": {
"delete_cmd_postfix": ") ",
"delete_cmd_prefix": "rm(",
"library": "var_list.r",
"varRefreshCmd": "cat(var_dic_list()) "
}
},
"position": {
"height": "545.49px",
"left": "1062.65px",
"right": "20px",
"top": "145px",
"width": "370px"
},
"types_to_exclude": [
"module",
"function",
"builtin_function_or_method",
"instance",
"_Feature"
],
"window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 5
}