-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex45.py
More file actions
executable file
·101 lines (88 loc) · 3.09 KB
/
ex45.py
File metadata and controls
executable file
·101 lines (88 loc) · 3.09 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
class Room(object):
r_dict = {
0:'Hallway',
1:'Kitchen',
2:'Bedroom',
3:'Toilet',
4:'Laundry'
}
class Engine(object):
"""This defines the engine of the game, calls maps etc, basically main."""
def __init__(self):
self.f_dict = {
0: Hallway(),
1: Kitchen(),
2: Bedroom(),
3: Toilet(),
4: Laundry()
}
def play(self):
# intro, room loop, finished
print "You're at a party and need to pee, good luck."
# start looping through rooms until peed == true and in hallway
n_room, peed = 0, False
while n_room != 0 or peed == False:
c_room = self.f_dict.get(n_room)
n_room, peed = c_room.enter(peed)
# games over
print "You did it! Go grab some pussy."
class Hallway(Room):
def enter(self, peed):
if peed == True:
return 0, False
else:
print "You're in the hallway, you can't pee here."
print "Pick a door, 1 - 4"
door_choice = 0
while door_choice < 1 or door_choice > 5:
door_choice = int(raw_input("> "))
in_choice = ""
print "You chose the %s, go in? (y/n)" % self.r_dict[door_choice]
while in_choice != "y" and in_choice != "n":
in_choice = raw_input("> ")
if in_choice == "y": return door_choice, False
if in_choice == "n": return 0, False
class Kitchen(Room):
def enter(self, peed):
in_choice = ""
print "You're in the kitchen, pee in the sink?"
while in_choice != "y" and in_choice != "n":
in_choice = raw_input("> ")
if in_choice == "y":
print "Someone yells at you so you run back to the party."
return 0, True
if in_choice == "n":
return 0, False
class Bedroom(Room):
def enter(self, peed):
in_choice = ""
print "You're in someone's bedroom, pee in the corner?"
while in_choice != "y" and in_choice != "n":
in_choice = raw_input("> ")
if in_choice == "y":
print "Someone beats the shit out of you, and you limp back to the party."
return 0, True
if in_choice == "n":
return 0, False
class Toilet(Room):
def enter(self, peed):
in_choice = ""
print "You're in the toilet, pee in the sink?"
while in_choice != "y" and in_choice != "n":
in_choice = raw_input("> ")
if in_choice == "y":
return 0, True
if in_choice == "n":
return 0, False
class Laundry(Room):
def enter(self, peed):
in_choice = ""
print "You're in the laundry, pee in the sink?"
while in_choice != "y" and in_choice != "n":
in_choice = raw_input("> ")
if in_choice == "y":
return 0, True
if in_choice == "n":
return 0, False
game0 = Engine()
game0.play()