-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdict.py
40 lines (31 loc) · 859 Bytes
/
dict.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
from sys import exit
from random import randint
def death():
quips = ["dead" , "fully dead" , "You are dead"]
print quips[randint(0, len(quips) -1)]
exit(1)
def princess_lives_here():
print "You meet the princess"
print "What do you do"
eat = raw_input(">")
if eat == "eat her":
return "death"
elif eat == "not at her":
return "death"
elif eat == "give her cake":
return "gold_pot"
def gold_pot():
print "take the gold pot and leave"
return "death"
rooms = {
'death' : death,
'princess_lives_here' : princess_lives_here,
'gold_pot' : gold_pot,
}
def runner(map, start):
next = start
while True:
room = map[next]
print " /n"
next = room()
runner(rooms, "princess_lives_here")